• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 671
  • Last Modified:

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.

0
roychan0328
Asked:
roychan0328
  • 3
  • 2
1 Solution
 
caterham_wwwCommented:
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

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

How can I do that?
0
 
caterham_wwwCommented:
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

0
 
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
http://localhost/folderfolder/
0
 
caterham_wwwCommented:
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.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now