Nginx – Alternatives to Apache

apache-2.2glassfishjettynginxtomcat

Our current stack is Apache + Tomcat + MySQL, using ProxyPass AJP to fire requests from Apache to Tomcat. We also run PHP for WordPress on the same sites, and so need working .htaccess files. In response to an annoying problem (see this Stack Overflow page), we're considering alternative stacks. Note that we generally quite like apache, but this problem is a show-stopper: if we can't fix it, we can't use Apache.

Alternatives include:

  • Tomcat alone
  • Glassfish (Java app server, forked from Tomcat)
  • Jetty (Java server)
  • Resin
  • LightTPD (lightweight HTTP server)
  • Nginx (lightweight HTTP server)

The way I see it, solutions fall into two camps: the pure Java camp, such as Glassfish; or the split camp such as our current Apache + Tomcat. We like the idea of a pure Java solution, since fewer moving parts should mean less to go wrong; but do any of them support PHP, .htaccess files, etc?

In theory we could do the split the other way – have a simple front end that proxies to Apache on only those bits that need those features – but in practice that would be 80% of requests.

What options do people suggest?

Best Answer

I strongly suspect your problem is related to AJP.

I was in a course with one of the main Tomcat developers a few weeks ago (he was running it), his advice was to avoid AJP and mod-JK etc, and stick to regular mod-proxy HTTP.

Reasons:

  1. It's by far the most mature and stable Tomcat connector.
  2. Neither AJP implementation has been consistently developed; both projects have suffered a bit of stop / start.
  3. NBIO does not result in any real world performance gain over blocking-IO, in this situation.

My advice, try using regular mod-proxy HTTP with your current setup. It's the least change for you and it will take you on to the most widely used and stable Tomcat deployment architecture.

/ Richy