Does Tomcat require Apache httpd?

IAmYourFaja picture IAmYourFaja · Feb 23, 2012 · Viewed 18.7k times · Source

If I am given a war file that contains a Java web application, and I want to run that war locally, then do I just need Tomcat, or do I need Tomcat and Apache httpd (or any other web server)? Thanks in advance!

Answer

Brendan Long picture Brendan Long · Feb 23, 2012

Tomcat is a web server of its own, so a separate web server like Apache is not required. You probably will want to change Tomcat's port though, since it defaults to 8080 and web sites are usually on port 80.

I think people generally put Apache in front of Tomcat so they can do things like:

  • Have one website have several Tomcat instances behind it.
  • Serve static files from Apache to take load off of Tomcat.
  • Use other Apache features you may need (modules).
  • As @TacticalCoder mentions in the comments, you need to be root to listen on port 80, so some people may be using Apache as an easy way to proxy port 80 to port 8080.

I'd recommend the YAGNI approach and just go with Tomcat until/unless you find a reason you want Apache in front of it.