Is it good idea to use Apache Webserver in front of GF or Tomcat? Does it improve the performance/security?
Or there is not any reason to use Apache Web Server with GF?
Is it good idea to use Apache Webserver in front of GF or Tomcat? Does it improve the performance/security?
Or there is not any reason to use Apache Web Server with GF?
Taken from https://cwiki.apache.org/confluence/display/TOMCAT/Connectors#Connectors-Q3
Since everybody gave you reasons why to put Apache in front of Tomcat let me give you some reasons why not to:
Putting Apache in front does NOT:
What Apache does give you is more plugins and allows you to run different web technologies.
If you only need Tomcat you would be better suited to use a HAProxy or Nginx as load balancer.
Scalability - As Amir and user384706 pointed out, you can load balance multiple instances of your application behind Apache. This will allow you to handle more volume, and increase stability in the event one of your instances goes down.
Security - Apache, Tomcat, and Glassfish all support SSL, but if you decide to use Apache, most likely thats where you should configure it. If you want additional protection against attacks (DoS, XSS, SQL injection, etc.) you can install the mod_security web application firewall.
Additional Features - Apache has a bunch of nice modules available for URL rewriting, interfacing with other programming languages, authentication, and a ton of other stuff.
Performance - If you have a lot of static content, serving it with Apache will improve your performance. If most of your content is dynamic, using Tomcat or Glassfish alone will be just as fast (probably faster). (as pointed out by answers to this question, this isn't true any more.)
One reason to place Apache in front of Tomcat would be for load balancing.
Requests hit the Apache server in front and are distributed to backend Tomcat containers depending on load and availability.
The clients know of only one IP (Apache) but the requests are distributed over multiple containers.
So this is in the case you deploy a kind of distributed web application and you need it robust.
If your question is about a simple web application then see dbyrne answer
If you're running a LAMP stack, you can run PHP/Ruby stuff off apache and forward java stuff to tomcat with mod_jk.