2011-02-25 3 views
5

도메인 뒤의 항목에 따라 다른 응용 프로그램으로 라우팅되는 가상 호스트 dev.company.com을 만들려고합니다. 특히, 내가 원하는 :Named VirtualHost 내에서 여러 ServerPath 지시문 사용

  • /젠킨스 - 노선을 젠킨스 서버에
  • /애플 리케이션 - 행 노선의 방문 페이지로 다양한 애플리케이션에 대한 링크
  • /클로버 - 행 노선의 특정 젠킨스에 구축 보고서 - http://dev.company.com/jenkins/job/proj-master-clover/clover/
  • /- 다른 모든해야 나는 다음과 같은 설정이 사용하고

Tomcat 서버으로 운항합니다 :

<VirtualHost *:80> 
    ServerName dev.company.com 

    ServerPath /jenkins 
    ProxyPass /jenkins http://easyrider:8080/jenkins 
    ProxyPassReverse /jenkins http://easyrider:8080/jenkins 

    ServerPath /clover 
    Redirect /clover http://dev.company.com/jenkins/job/proj-master-clover/clover/ 

    ServerPath /apps 
    DocumentRoot "/usr/local/sites/developers" 
    <Directory "/usr/local/sites/developers"> 
     DirectoryIndex index.html 
     Options Indexes MultiViews 
    </Directory> 

    ServerPath/
    ProxyPass/http://tomcat_server:8080/ 
    ProxyPassReverse/http://tomcat_server:8080/ 
</VirtualHost> 

http://dev.company.com/jenkins 잘 작동하지만/apps 및/clover는 항상 Tomcat 서버로 리디렉션합니다. 이 작업을 수행하는 올바른 방법입니까?

답변

8

ServerPath를 사용하는 것이 대부분 레거시 브라우저 용입니다. 트릭 그러나 별칭을 얻고 당신이 포괄 사용하는 경우 리디렉션이 가상 호스트에서 작업에 : ProxyPass /path ! 표기

그래서 내 마지막을 :

ProxyPass/<url> 

특정 경로를 무시 ProxyPass로 말씀입니다

<VirtualHost> 
    ServerName dev.company.com 

    ProxyPass /jenkins http://easyrider:8080/jenkins 
    ProxyPassReverse /jenkins http://easyrider:8080/jenkins 

    # Tells ProxyPass to ignore these paths as they'll be handled by Alias and Redirect 
    ProxyPass /clover ! 
    ProxyPass /apps !   

    Redirect /clover http://dev.company.com/jenkins/job/proj-master-clover/clover/ 

    Alias /apps "/usr/local/sites/developers" 
    <Directory "/usr/local/sites/developers"> 
     DirectoryIndex index.html 
     Options Indexes MultiViews 
    </Directory> 


    ProxyPass/http://tomcat_server:8080/ 
    ProxyPassReverse/http://tomcat_server:8080/ 
</VirtualHost> 

을하고 URL은 다음과 같습니다 : 가상 호스트는 다음과 같습니다

http://dev.company.com/jenkins* - will proxy to jenkins http://dev.company.com/jenkins 
http://dev.company.com/apps - will proxy to http://dev.company.com/apps/ 
http://dev.company.com/clover - will redirect to http://dev.company.com/jenkins/job/proj-master-clover/clover/ 
and everything else will go to tomcat at tomcat_server:8080