标题有点混乱,所以这里有一些背景:我有一个运行在8080上的Tomcat服务器需要被保护。 我configuration了Apache来终止SSL和代理到Tomcat,就像这样(我认为我是正确的):
ProxyRequests off ProxyPreserveHost on ProxyPass /jira http://localhost:8080/jira ProxyPassReverse /jira http://localhost:8080/jira <VirtualHost _default_:443> SSLEngine on ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ </VirtualHost>
这按预期工作,除了现在我想保护我的Web服务器中的其他目录,例如Mercurial存储库。 当我创build所述目录并需要SSL时,请求被转发到Tomcat(就像我告诉它…在这种情况下不是我想要的)。
所以我的问题是:我如何改变我的configuration,所以我只能转发某些请求到Tomcat服务器?
Shane的回应更新了解决scheme:
<VirtualHost _default_:443> SSLEngine on ProxyPass / ! ProxyPass /jira http://localhost:8080/jira ProxyPassReverse /jira http://localhost:8080/jira </VirtualHost>
这样做是有意义的,因为我只是代理我需要的应用程序。
在现有configuration之前使用ProxyPass豁免,以避免代理某些位置:
ProxyPass /location/to/not/proxy ! ProxyPass /other/location/to/not/proxy ! ... ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/