2011-03-05 2 views
0

여러 웹 사이트 버전이 있습니다. 각각의 예를 들어, 자신의 폴더에있는 : 사이트의 각 버전은 루트 디렉토리의 자신의 정의를 가질 수 있도록아파치를 사용하는 루트 디렉토리가있는 웹 사이트의 여러 버전

site_v1/ 
    index.html 
    page1.html  

site_v2/ 
    index.html 
    page1.html 

가 어떻게 아파치를 구성 할 수 있습니다? 즉

, 나는 site_v1/index.html을 루트 디렉토리가 site_v1 생각하고,/index.html을 site_v2 당신은 VirtualHost 지시어를 찾고 있습니다 site_v2

답변

2

, 당신은 실제로 VirtualHost 지시어를 찾고 있습니다,하지만 그래도 난 당신의 가상 호스트 설정에 대한 예제 구성을 추가 할 수 있습니다. 이 사용자의 기호에 편집하여 httpd.conf 파일에 배치하고, 전체 경로를 입력하는 것을 기억해야한다 : 당신이 원하는 경우

NameVirtualHost v1.yoursite.com:80 
<VirtualHost v1.yoursite.com:80> 
    ServerName v1.yoursite.com 
    ServerAlias v1.yoursite.com 
    DocumentRoot /path/to/site_v1 
    ErrorLog /path/to/prefered/error.log 
    CustomLog /path/to/prefered/access.log combined 
    <Directory /path/to/site_v1> 
     Options Indexes FollowSymLinks MultiViews 
     AllowOverride None 
     Order allow,deny 
     Allow from all 
    </Directory> 
</VirtualHost> 

NameVirtualHost v2.yoursite.com:80 
<VirtualHost v2.yoursite.com:80> 
    ServerName v2.yoursite.com 
    ServerAlias v2.yoursite.com 
    DocumentRoot /path/to/site_v2 
    ErrorLog /path/to/prefered/error.log 
    CustomLog /path/to/prefered/access.log combined 
    <Directory /path/to/site_v2> 
     Options Indexes FollowSymLinks MultiViews 
     AllowOverride None 
     Order allow,deny 
     Allow from all 
    </Directory> 
</VirtualHost> 

, 당신의 각 버전에 대해 서로 다른 액세스/오류 로그를 사용하기로 결정했습니다 수 있습니다 당신의 대지. 이름/경로를 로그 파일로 변경하면 완료됩니다. /path/to은 사이트 폴더의 경로이며 v1.yoursite.com & v2.yoursite.com은 각 버전에 사용할 상대 도메인으로 변경해야합니다. 로그 파일을 변경하지 않으려면 ErrorLogCustomLog 지시문을 삭제하면 httpd.conf에 설정된 기본 로그 파일이 기본값으로 사용됩니다.

관련 문제