Tomcat server root application with apache http proxy on cent os

Posted on 2008-11-10
Last Modified: 2013-12-02
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.

Question by:roychan0328
    LVL 27

    Expert Comment

    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


    Author Comment

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

    How can I do that?
    LVL 27

    Expert Comment

    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


    Author Comment

    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
    LVL 27

    Accepted Solution

    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.

    Featured Post

    Highfive Gives IT Their Time Back

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    It is possible to boost certain documents at query time in Solr. Query time boosting can be a powerful resource for finding the most relevant and "best" content. Of course the more information you index, the more fields you will be able to use for y…
    In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    745 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now