2017-05-27 55 views
0

我們正試圖爲我們的軟件工廠設置一個反向代理。我們可以設法將所有Atlassian套件置於反向代理之下,但與Jenkins和Sonar一起努力。設置Apache反向代理tomcat的正確方法是什麼(Jenkins,Sonar)

這裏是Apache的配置:

<VirtualHost *:443> 
      SSLCertificateFile /etc/apache2/ssl/atoe.crt 
      SSLCertificateKeyFile /etc/apache2/ssl/atoe.key 
      SSLCertificateChainFile /etc/apache2/ssl/bundle.crt 

      ProxyRequests Off 
      ProxyPreserveHost On 
      ProxyVia Off 

      <Proxy *> 
        Order deny,allow 
        Require all granted 
      </Proxy> 
      <Proxy http://localhost:9010/jenkins*> 
       Order deny,allow 
       Allow from all 
      </Proxy> 

      ProxyPass /confluence http://localhost:8090/confluence 
      ProxyPassReverse /confluence http://localhost:8090/confluence 

      ProxyPass /bitbucket http://localhost:7990/bitbucket 
      ProxyPassReverse /bitbucket http://localhost:7990/bitbucket 

      ProxyPass/http://localhost:8095/ 
      ProxyPassReverse/http://localhost:8095/ 

      ProxyPass /sonarqube http://localhost:9000/sonarqube 
      ProxyPassReverse /sonarqube http://localhost:9000/sonarqube 
</VirtualHost> 

兩個Sonarqube和詹金斯在Tomcat的7.0.69下運行。我在sonar.properties和/ etc/default/jenkins中更改了它們的上下文,如上所示設置正確的上下文。當試圖通過代理連接到這些工具時,我得到了404錯誤。

apache2的日誌中沒有提及任何內容。

我錯過了什麼嗎?

感謝您的幫助

回答

0

嗯,看來的ProxyPass的順序很重要。如果我們定義一個「/」,最後必須定義它,否則在此之後將不再考慮。

在我們的例子中,我們有:

 ProxyPass /confluence http://localhost:8090/confluence 
     ProxyPassReverse /confluence http://localhost:8090/confluence 

     ProxyPass /bitbucket http://localhost:7990/bitbucket 
     ProxyPassReverse /bitbucket http://localhost:7990/bitbucket 

     ProxyPass/http://localhost:8095/ 
     ProxyPassReverse/http://localhost:8095/ 

     ProxyPass /sonarqube http://localhost:9000/sonarqube 
     ProxyPassReverse /sonarqube http://localhost:9000/sonarqube 

,使其工作,我們不得不顛倒最後兩個:

 ProxyPass /confluence http://localhost:8090/confluence 
     ProxyPassReverse /confluence http://localhost:8090/confluence 

     ProxyPass /bitbucket http://localhost:7990/bitbucket 
     ProxyPassReverse /bitbucket http://localhost:7990/bitbucket 

     ProxyPass /sonarqube http://localhost:9000/sonarqube 
     ProxyPassReverse /sonarqube http://localhost:9000/sonarqube 

     ProxyPass/http://localhost:8095/ 
     ProxyPassReverse/http://localhost:8095/ 
相關問題