Tomcat server root application with apache http proxy on cent os

How to set up tomcat 5 + apache httpd proxy at the root so that will hit my application?

I am running centos and both http and tomcat are running as default sevices.

Who is Participating?
caterham_wwwConnect With a Mentor Commented:
Yes, if mod_proxy_http is loaded.

> apache httpd redirect me to

That should not be caused by the ProxyPass directive but by sthg. else.
Are there certain paths/extensions which should go through the proxy? Or every request?

For apache 2.2, you'll need the following modules (check the LoadModule section of your httpd.conf)
- mod_proxy
- mod_proxy_ajp

You can proxy every request to tomcat via [1] in your httpd.conf, while the port of your tomcat server may differ.
ProxyPass / ajp://localhost:8091/
ProxyPassReverse / ajp://localhost:8091/

Open in new window

roychan0328Author Commented:
So I have to move my application to the root of tomcat first, right?

How can I do that?
No, if your application lives in a subfolder, you can specify the folder:
ProxyPass / ajp://localhost:8091/folder/
ProxyPassReverse / ajp://localhost:8091/folder/
ProxyPass /foo ajp://localhost:8091/folder
ProxyPassReverse /foo ajp://localhost:8091/folder
depending upon your needs.

Open in new window

roychan0328Author Commented:
does it work with http proxy instead of ajp?

I tried to do this
ProxyPass / http://localhost:8091/folder/
ProxyPassReverse / http://localhost:8091/folder/

and I got 404

apache httpd redirect me to
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.