Link to home
Start Free TrialLog in
Avatar of roychan0328
roychan0328

asked on

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

http://mydomain.com will hit my application?

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

Avatar of caterham_www
caterham_www
Flag of Germany image

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.
[1]:
 
ProxyPass / ajp://localhost:8091/
ProxyPassReverse / ajp://localhost:8091/

Open in new window

Avatar of roychan0328
roychan0328

ASKER

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/
 
or
 
ProxyPass /foo ajp://localhost:8091/folder
ProxyPassReverse /foo ajp://localhost:8091/folder
 
depending upon your needs.

Open in new window

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
http://localhost/folderfolder/
ASKER CERTIFIED SOLUTION
Avatar of caterham_www
caterham_www
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial