Nginx 1, Apache 0
Filed under: nginxI spent the better part of the evening converting several sites belonging to a friend of mine from Apache to Nginx. Previously the front page of the biggest site (written in Joomla) took anywhere from 5 to 10 seconds to load. If request load got even moderately heavy, Apache would quickly exhaust the 256MB of memory available in the VPS and the site would become permanently unavailable as processes were killed by the kernel, requiring the VPS to be restarted.
After this happened three times over a period of a week, I decided to take some action. I tried the "easy method", tuning Apache by following guides I found that purported to make Apache suitable to a VPS, but nothing really helped. At best they made the site slower and delayed the inevitable crash. Finally I bit the bullet and converted them all to Nginx (I was reluctant to do so because I'm not terribly familiar with Joomla and there aren't many examples around for running Joomla on anything but Apache - and previous trials a few years ago with Nginx + Mambo turned out to be a huge pain).
At the end of it all, the Nginx configuration turned out to be remarkably simple, and page loads are down to under 3 seconds (the site is very image-heavy and Joomla isn't terribly efficient). And of course, Nginx's memory utilization never exceeds a few megabytes, regardless of load.
To be fair, I'm anything but an Apache expert, so I'm curious if there really is a solution to running something like Joomla in a VPS with 256MB of RAM under Apache. If you think you have the answer, please post it in the comments.







I have never used Nginx nor Joomla (and I do not plan to discourage you from the new setup :), but the symptoms could be easily caused by Joomla running using mod_php on Apache. That effectively means that each Apache process has its own PHP interpreter in memory. The Nginx config specifies FastCGI, where PHP interpreter runs independently on the webserver processes (and is called by those).
Apache can use FastCGI too (but it's not default). You probably could have solved your memory issue by switching Apache to FastCGI (and disabling unused Apache modules). But since switching to Nginx seems to have solved your problem, enjoy :-)