2017-05-27 60 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/ 
相关问题