用httpd.conf和mod_proxy_ajpparsing两个tomcat实例到两个不同的目录

请原谅我对这个话题的无知。 我已阅读,search和search,我仍然挣扎着我的设置。

我想设置我的httpd.conf允许一个域,有两个目录parsing到两个不同的tomcat实例。

www.example.com/first

<VirtualHost "ip address":80> ServerName example/first ErrorLog /var/log/httpd/first_error.log CustomLog /var/log/httpd/first_access.log combined <Proxy *> AddDefaultCharset off Order deny,allow Allow from all </Proxy> ProxyPass / ajp://localhost:8009/ ProxyPassReverse / ajp://localhost:8009/ </VirtualHost> 

www.example.com/second

 <VirtualHost "ip address":80> ServerName example/second ErrorLog /var/log/httpd/second_error.log CustomLog /var/log/httpd/second_access.log combined <Proxy *> AddDefaultCharset off Order deny,allow Allow from all </Proxy> ProxyPass / ajp://localhost:8010/ ProxyPassReverse / ajp://localhost:8010/ </VirtualHost> 

我知道这是错误的,我想我应该使用<Directory> ,或者我应该指定的Tomcat实例:

ProxyPass /example1 ajp://localhost:8010/

ProxyPass /example2 ajp://localhost:8009/

请发送帮助。 用品/士气低。

或链接到例子…谢谢!

对于您的第一个拆分URI代理,我build议您避免使用<Location><Directory> 。 目录映射到实际的文件系统目录 ,而位置映射到URIpath。 后者就是你想要完成的,但实际上你并不需要一个容器来完成这个工作。 (它只是使configuration更清洁)

通过ProxyPass /first ajp://localhost:8009ProxyPass /second ajp://localhost:8010使用一个<VirtualHost> 。 我可以给你完整的configuration,但是我希望你稍微努力一点。 如果你弄清楚上述的困惑,那么你已经接近完成了。

解决了。

 <VirtualHost "ip address":80> ServerName example.com ErrorLog /var/log/httpd/error.log CustomLog /var/log/httpd/access.log combined ProxyPass /first/ ajp://localhost:8009/first/ ProxyPass /second/ ajp://localhost:8010/second/ </VirtualHost>