env: cenots5
apache + tomcat (ajp)
apache ip:192.168.0.100 port 80 ,vhost domain:
www.test.com
tomcat1 ip: 192.168.0.101 port 8080
tomcat2 ip:192.168.0.102 port 8080
when visit
http://www.test.com/shop/
it actual visit tomcat2 192.168.0.102/shop/index-2000.html
and
http://www.test.com/shop/bottom/reg.html ---->
192.168.0.102/shop/bottom/reg.html
http://www.test.com/shop/other/login.html ---->
192.168.0.102/shop/other/login.html
i use apache rewrite and proxy module(related rewrite proxy module has been compiled and loaded) to do it
my apache confuguration:
Code:
<VirtualHost *:80>
# DocumentRoot "/apache/htdocs"
ServerName www.test.com
RewriteEngine On
RewriteRule ^(.*)$ http://www.test.com/index-2000.html
ProxyRequests Off
ProxyMaxForwards 100
ProxyPreserveHost On
ProxyPass / http://192.168.0.102:8080/shop/
ProxyPassReverse / http://192.168.0.102:8080/shop/
<Proxy *>
Order Deny,Allow
Allow from all
</Proxy>
</VirtualHost>
OR
Code:
<VirtualHost *:80>
# DocumentRoot "/apache/htdocs"
ServerName www.test.com
RewriteEngine On
RewriteRule ^/$ http://www.test.com/index-2000.html
ProxyRequests Off
ProxyMaxForwards 100
ProxyPreserveHost On
ProxyPass / http://192.168.0.102:8080/shop/
ProxyPassReverse / http://192.168.0.102:8080/shop/
<Proxy *>
Order Deny,Allow
Allow from all
</Proxy>
</VirtualHost>
my question:
it dont work ,why.
if i configure apache like this
Code:
<VirtualHost *:80>
ServerName www.test.com
ProxyRequests Off
ProxyMaxForwards 100
ProxyPreserveHost On
ProxyPass / http://192.168.0.102:8080/shop/index-2000.html
ProxyPassReverse / http://192.168.0.102:8080/shop/index-2000.html
<Proxy *>
Order Deny,Allow
Allow from all
</Proxy>
</VirtualHost>
visit
http://www.test.com/shop/
--->192.168.0.102/shop/index-2000.html
ok
but
http://www.test.com/shop/bottom/reg.html ---->
192.168.0.102/shop/bottom/reg.html
dont work !
http://www.test.com/shop/other/login.html ---->
192.168.0.102/shop/other/login.html
dont work !
why...give me a hint!thx