36

I currently have Apache httpd running on a production Ubuntu VPS server. I write php scripts.

I'm interested in learning Java and I was wondering how I would go about writing some server-side Java to work on my current set-up.

How are Apache Tomcat and Apache HTTP Server related to each other?

Can Tomcat be a module of httpd?

Or are they simply just two very different projects that happen to be steered by the same organisation (Apache Software Foundation)?

2
  • 5
    Or are they simply just two very different projects that happen to be steered by the same organisation? - They are
    – Mchl
    Commented Jan 8, 2011 at 17:48
  • @Mchl, They are very similar too.
    – Pacerier
    Commented Jan 19, 2015 at 6:47

1 Answer 1

58

In general, the Apache HTTP server is just a plain old web server designed to serve static web pages. There are plenty of modules which can be installed to enhance Apache's abilities so that it can serve dynamic webpages using various technologies such as PHP, CGI or whatever, but the core of Apache is just a plain old HTTP server.

Tomcat, on the other hand, is specifically designed from the ground-up to serve as a Java Servlet engine. It's primary purpose is to implement the Java Servlet API and execute Java servlets for the purpose of building dynamic websites. Tomcat can also be used as a regular HTTP server that serves static pages, but that is not its primary purpose. (Also, Tomcat is allegedly slower than Apache httpd when it comes to serving static pages.)

The two technologies can be used together through a connector module called mod_jk. This will allow you to use the Apache HTTP server to serve regular static webpages, and the Tomcat Servlet engine to execute servlets.

5
  • Can we say that when one downloads Tomcat s/he downloads a Web Server like Apache Httpd (but not exactly this) AND a Servlet Container which is simply a java application? Commented Nov 25, 2014 at 18:22
  • @Charles, Why is Tomcat slower than Apache?
    – Pacerier
    Commented Jan 19, 2015 at 6:48
  • @Pacerier - he said "allegedly", because while people widely believe this, in reality it isn't true.
    – Jules
    Commented May 2, 2016 at 7:07
  • @KorayTugay not exactly, no. Tomcat is just a servlet container. It happens to come supplied with a default servlet that implements a static web server. You couldn't separate out the web server component without the servlet container.
    – Jules
    Commented May 2, 2016 at 7:15
  • It's completely wrong to state that Apache was "designed to serve static web pages". CGI came with the NCSA server in 1993, and Apache was first released in '95. The same person was responsible for both. Even PHP was released in '94. Apache has always served anything that could be generated by a program. Tomcat did not create the dynamic web: CGI, and to a large extent Apache, did, a long time ago. Tomcat adds a vast amount of functionality for people who think that's a good thing.
    – EML
    Commented Sep 11, 2023 at 19:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.