Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

just wondering which web server between Apache and Nginx is better supported from Tomcat? I'm attracted in using Nginx for the single-threaded feature. I want to deploy a Java app running on HTTPS.


share|improve this question
And you don't want to run Tomcat in stand-alone mode? – mailq Aug 10 '11 at 12:44
I thought using a web server in front of Tomcat in production was a better practice. – sebarmeli Aug 10 '11 at 13:09
Security guys get nervous when you run tomcat in production and have tomcat listen on 80/443 because tomcat would need to run as root. But if you're running linux, you can use something like ipchains to translate port 80 to 8080 and port 443 to 8443 and leave tomcat running as a regular user. – mahnsc Aug 10 '11 at 13:18
up vote 3 down vote accepted

First of all: Tomcat is faster to run standalone (logically, as there is no need for proxying). It's probably not the most secure solution, but it is faster. :)

Apache can use the mod_jk connector wich utilizes AJP13, wich gives you a vast performance boost compared to regular HTTP proxying. If you really need to use a frontend then go for Apache+mod_jk.

share|improve this answer
In our load testing of a very large application, AJP13 versus straight HTTP proxying didn't make any difference. In fact, using nginx to proxy to Tomcat via HTTP actually resulted in higher overall scalability with the same hardware at hand (probably because nginx is event-based, and Apache was managing a whole OS thread for each connection). We had 1 dual-core proxy server (running nginx 0.7.65 or Apache 2.2.x depending on the test) and six servers running a monster Tomcat/JBoss application for this test. Tomcat also sucks at serving static files compared to a Apache/nginx. – rmalayter Aug 15 '11 at 20:04
@rmalayter: Sorry if I wasn't clear about the static bit, what I really ment was "Tomcat serves applications faster standalone". How were apache configured for your test enviroment? Was it stripped down? – pauska Aug 15 '11 at 20:20
We used the default Apache and nginx packages on Ubuntu 10.04, with only essential modules enabled. As far as Tomcat being faster "standalone", that really isn't an option for most production applications, as Tomcat doesn't support a whole lot of critical web server features without writing custom servlets or filters. And it is very slow for static file serving, which is also critical for many applications. – rmalayter Aug 24 '11 at 3:13

Apache -> Tomcat is probably a bit more flexible due to the number of different connector options available but nginx is supposed to be extremely fast. That being said, as mailq suggests, you might be happy enough with tomcat acting as your front-end.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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