Tomcat – PHP and JSP running on same machine.. Tomcat on Apache

apache-2.2mod-jktomcat

Sorry if this has been posted/answered already, but I cannot find the simple answer.

I have two applications one JSP and one PHP both hosted on same machine running apache and tomcat. Apache is listening on 80 and tomcat on 8080.

Where can I get a step-by-step guide to have the urls pointed to specific app. I am not savvy when it comes to linux and apache settings.

All the information I have found so far either leads me to another complicated link or somehow the instructions cannot be followed.

Please help.

Best Answer

Well, you can do it in two ways:

  1. Using apache mod_rewrite to rewrite the URLs, it's not very easy but works
  2. Using something in front of apache to provide a reverse proxy. nginx is a very popular option, very fast and easy do configure. Varnish is a caching reverse proxy, it's harder to configure than nginx but provides cache.

There are some examples: nginx full example, Varnish config examples, apache rewrite guide.

IMNSHO, nginx is the best choice if you will not have thousands of accesses, if this is the case, nginx + varnish can do miracles.