Tomcat and Apache HTTP Server

Posted under » Ubuntu » Linux » Apache on 20 July 2010

Most of the time, you already have a web server running at port 80 and its probably Apache. To begin you must install Tomcat first.

If you read my CherryPy installation article, I've used mod_rewrite for the wrapping which is quite easy to do but not efficient. Tomcat is just a bit harder.

#1 on Tomcat itself you have to enable the AJP Connector by modifying the server.xml at the conf. location.



Restart Tomcat.

#2 Enable the required Apache proxy module

If using Ubuntu.

ln -s /etc/apache2/mods-available/proxy_balancer.load /etc/apache2/mods-enabled/proxy_balancer.load
ln -s /etc/apache2/mods-available/proxy_ajp.load /etc/apache2/mods-enabled/proxy_ajp.load
ln -s /etc/apache2/mods-available/proxy.load /etc/apache2/mods-enabled/proxy.load

#3 Change the Apache config


    ServerName example.com.sg
    ProxyRequests Off
   
     Order deny,allow
     Allow from all
   
ProxyPass / ajp://localhost:8009/docs/
ProxyPassReverse / http://example.com.sg/

Thanks to humboldt for the ProxyPassReverse tip.

Restart Apache.

web security linux ubuntu python django git Raspberry apache mysql php drupal cake javascript css AWS data