가상 호스트 설정


10

현재 모든 웹 사이트가 아래에 디렉토리로 /var/www있습니다. 디렉토리 http://foo/를 가리키는 가상 호스트를 설정 /var/www/foo/foo하고 여전히 기본 로컬 호스트 동작을 유지하고 싶습니다 .

다음 파일을에 추가 foo했습니다 /etc/apache2/sites-available/.

<VirtualHost *:80>
    ServerName foo
    DocumentRoot /var/www/foo/foo

    # Other directives here
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/foo/foo>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>

그런 다음 다음 명령을 실행했습니다.

sudo a2ensite foo
sudo /etc/init.d/apache2 reload

그러나 내가 가면 http://foo/여전히 ISP 검색 페이지가 반환됩니다.

답변:


15

127.0.0.1로 해결 /etc/hosts되도록 파일 을 편집해야 합니다 http://foo.

/etc/hostssudo / root를 사용 하여 파일을 편집하고 다음 행을 추가하십시오.

127.0.0.1 foo

1

Checkout https://github.com/Aslamkv/vh :)

이 도구를 사용하면 모든 구성을 수행하여 Ubuntu에서 가상 호스트를 추가하고 제거 할 수 있습니다. 간단하고 사용하기 쉽습니다.

면책 조항 : 나는 저자입니다 : P


0

아파치를 사용하는 사람들을 위해. 당신은해야합니다

Ensure you have .htaccess in root path of the site you are hosting. Example /var/www
Update the /etc/apache2/sites-available/default

에서

<Directory /var/www/>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride None
 Order allow,deny
 allow from all
</Directory>

<Directory /var/www/>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride All
 Order allow,deny
 allow from all
</Directory>

이것이 누군가를 돕기를 바랍니다.


directory블록이 달라야하지 않습니까?
gion_13

당사 사이트를 사용함과 동시에 당사의 쿠키 정책개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.