Sharing the Point

Office 365, SharePoint, Project Server – Blog

Posts Tagged ‘Apache Tomcat’

How to Redirect all Apache 2.x Request to Tomcat 6.x.x using mod_proxy Module

Posted by Ashraf on January 2, 2011

Consider: Apache 2.x is running on port 80, Tomcat 6.x.x is on port 8080

  1. Got to {Apche2 installation folder}\Apache2.2\conf , Open httpd.conf to edit
  2. Uncomment the following three lines,
    1. LoadModule proxy_module modules/mod_proxy.so
    2. LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
    3. LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
  3. Add the following entry to the main section of httpd.conf file

      #Enableing proxy for rediretion to tomcat

      ProxyRequests Off

      ProxyPreserveHost On

      <Proxy *>

      Order deny,allow

      Allow from all

      </Proxy>

      ProxyPass / ajp://localhost:8009/

      ProxyPassReverse / ajp://localhost:8009/

      <Location / >

      Order allow,deny

      Allow from all

      </Location>

  4. Test by typing http://localhost; tomcat default page will come up.

Posted in System Administration, Windows Server | Tagged: , , , | 3 Comments »

How to Display Custom Error Page on Tomcat 6

Posted by Ashraf on December 3, 2010

If you are Unhappy with the default error pages that come with Tomcat then You can define your own custom error pages in your web.xml file after the following tag:

<welcome-file-list>

<welcome-file>index.html</welcome-file>

</welcome-file-list>

In the example shown below, i define 2 html pages — web_server_error_500.html and file_not_found_404.html which will be displayed when the server encounters an error 500 or an error 404 respectively. Put your html files on tomcat6.0/webapps/Root folder.  And add this code on web.xml file.

<error-page>

<error-code>500</error-code>

<location>/web_server_error_500.html</location>

</error-page>

<error-page>

<error-code>404</error-code>

<location>/file_not_found_404.html</location>

</error-page>

Please be aware that the order of the tags for the web.xml file is very important. If the order in your web.xml file is incorrect, Tomcat will output errors on startup.

And for Internet Explorer users be sure you have enabled “Show custom error pages” from Internet Options>Advanced tab.

Posted in System Administration | Tagged: , , , | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.

Join 59 other followers