views:

376

answers:

4

Can Apache HTTP Server serve only static content? Tomcat is used to serve Servlets/JSP. Can Tomcat serve other dynamic contents like perl, PHP etc?

A: 

Of course Apache is able to serve dynamic content! mod_perl, mod_php, and so are the modules you plug to Apache to give him the ability to serve them.

gizmo
+1  A: 

In a word: Yes :P

mod_perl
mod_python

Richard Nienaber
+14  A: 

Apache HTTP Server (http://httpd.apache.org) has:

  • CGI support: mod_cgi. This will run almost any dynamic content, you can even write a CGI in Bash.

  • WSGI support: mod_wsgi

  • FastCGI support: mod_fcgid (CGI, but more efficient)

  • Perl support: mod_perl

  • PHP support: mod_php

  • Python support: mod_python (using mod_wsgi is recommended)

  • Ruby support: mod_ruby (thanks to David Holm)

  • Bridge to serve Java content through a servlet container such as Tomcat: mod_jk, mod_proxy_ajp

  • Plus, an API to program your own apache modules that'll enable you to do as you wish, here's a repository of some of the existing modules: http://modules.apache.org

If you meant if Tomcat can, it cannot outside of a Java environment, it is only a servlet container. That said, Java can execute some other scripting languages and thus you could write programs to generate content in all supported scripting engines.

Vinko Vrsalovic
+1  A: 

Don't forget mod_ruby.

David Holm