反向代理来进行apache+tomcat的整合

这里再说一下关于反向代理来进行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>

你可能感兴趣的:(apache,tomcat,反向代理,整合)