Tomcat – How to use mod_proxy to let the index of Apache go to Tomcat ROOT and be able to browse the other Apache sites

apache-2.2mod-proxytomcat

I am trying to use my Tomcat application (deployed at ROOT) to be viewed from Apache port 80. To do this, I used mod_proxy, since mod_jk made me try harder.

I used sth like this in httpd.conf:

<location http://www.example.com>
   Order deny,allow
   Allow from all
   PassProxy http://localhost:8080/
   PassProxyReverse http://localhost:8080/ 
</location>
<Proxy *>
   Order deny,allow
   Allow from all
</Proxy>

And now I can not retrieve my previous sites on Apache, which was running prior to my configuration.

How can I have both running?

Best Answer

Firstly, your proxypass syntax is wrong, I don't know how did this work at all. It should be

ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/

You have to have a separate Location section for every url you don't want to proxy to tomcat in front of the last proxying location, i.e.

<location /somedirectory>
   Order deny,allow
   Allow from all
   Options somethingorother
</location>

<location /some.html>
   ....
</location>

<location http://www.example.com>

....
</location>