2013-08-16 5 views
0

사용 :내가이 가상 호스트 내 아파치를 설정하려고 아파치 가상 호스트

Listen 11.22.33.44:8080 

<VirtualHost *> 
    ServerName servername.com/stable 
    DocumentRoot /home/deploy/producao/servername.com/current/public 
    <Directory /home/deploy/producao/servername.com/current/public> 
     # This relaxes Apache security settings. 
     AllowOverride all 
     # MultiViews must be turned off. 
     Options -MultiViews 
    </Directory> 
</VirtualHost> 

<VirtualHost *> 
    ServerName servername.com/stable 
    DocumentRoot /home/deploy/teste/servername.com/current/public 
    <Directory /home/deploy/teste/servername.com/current/public> 
     # This relaxes Apache security settings. 
     AllowOverride all 
     # MultiViews must be turned off. 
     Options -MultiViews 
    </Directory> 
</VirtualHost> 

을하지만 모두가 잘못된 것입니다. 내가 원하는 것은 servername.com/stable을 입력 할 때 하나의 문서 루트를 얻었고 servername.com/testing을 사용할 때 다른 하나를 얻습니다.

나는

<VirtualHost servername.com/stable> 
<VirtualHost servername.com/testing> 

및 사용

ServerName servername.com 
ServerPath /stable 
... 
ServerName servername.com 
ServerPath /testing 

과 같은 몇 가지 있지만 없음 작업을 tryed 그러나이 중 어느 것도 작동하지 않습니다.

답변

0

ServerName 지시어가 잘못되었습니다. 해당 지시문을 사용하는 DNS 호스트 이름 만 지정할 수 있습니다. NOT 서버 경로. 예 :

ServerName example.com 
ServerName example.net 

이 맞습니다. SAME 서버 이름의 하위 디렉토리에 두 개의 서로 다른 사이트를 호스팅하려고합니다. 이를 위해 두 개의 가상 호스트 지시문이 필요하지 않습니다. 단일 가상 호스트 내에있는 <Directory> 또는 <Location>.

<VirtualHost *> 
    ServerName example.com 
    <Location /site1> 
     ... site1 settings here 
    </Location> 
    <Location /site2> 
     ... site2 settings here 
    </Location> 
</VirtualHost>