2013-09-21 10:17:01
来 源
IT技术网
Apache
本文介绍使用反向代理整合Apache+tomcat的配置方法,希望对于初学Apache服务器相关的朋友有帮助,更多Apache安装、配置、报错处理等资源请本站内搜索。

这里再说一下关于反向代理进行apache+tomcat的整合,既然是反向代理,那tomcat-connectors就不用装了,配置文件也无需更改,只需装好apache、tomcat、jdk,开启各自服务后,修改httpd.conf,在文件最后加入如下语句:

<Proxy balancer://localCluster>

BalancerMember ajp://localhost:8009

</Proxy>

RewriteEngine On

ProxyPreserveHost On

RewriteRule ^/$ balancer://localCluster/

RewriteRule ^/(.*)$ balancer://localCluster/$1

虚拟主机配置,静态网页,图片,CSS由apache负责处理,/search ,/job两个目录下是动态JSP页面,反代到tomcat服务器处理

<VirtualHost *:80>

<Directory "/var/xx.com/www">

Options -Indexes FollowSymLinks

Allow from all

AllowOverride All

</Directory>

ServerAdmin [email protected]

DocumentRoot "/var/xx.com/www"

ServerName 192.168.8.10

ProxyRequests Off

<Proxy *>

Order deny,allow

Allow from all

</Proxy>

ProxyPass /search http://192.168.0.13:8080/search/

ProxyPassReverse /search http://192.168.0.13:8080/search/

ProxyPass /job http://192.168.0.13:8080/job/

ProxyPassReverse /job http://192.168.0.13:8080/job/

</VirtualHost>

声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。