As I was looking for a VPS hosting for my two domains, I realised that to run Apache / PHP / MySQL on a host with more than 500 unique visitors per day I need to by at least 512Mb or dedicated RAM, if not 1024Mb (costly!).

I decided to investigate the possibility of running SMF (simplemachines forum) along with PrettyURL module for SEO optimisation (using Apache mod_rewrite plugin) inside nginx which everyone talks about as being lightweight and stable.

Converting PrettyURL rules:

After some trial and error, I came up with these rules that have to be added in nginx.conf file:

Update on 23 Jan, 2009:

Here are the settings I’ve now been using for almost one year:


So far, it works! The memory footprint for nginx, php5 (running as fastcgi server) is around 100Mb (while the system itself, at boot, takes about 30Mb). MySQL database is hosted on the main system [in fact, I am running everything inside a coLinux hosted Ubuntu 6.06 – with nginx compiled from source code as I haven’t found a package for Ubuntu 6.06]. Database resides on Windows XP right now, outside the coLinux environment.

On my Toshiba L10-202, with a CeleronM at 1600Mhz, with coLinux set up to use maximum 256Mb, I still get the SMF page rendered in less than 0.12s. Which is pretty impressive!

I will keep this post updated, as I am still investigating how to make WordPress MU (which I integrated with SMF using a sweet module from and still have everything working toghether.

PS: Another option for lightweight ‘hosting package’ was lighttpd, but I gave up on it mainly because even if advertisied as fast and easy, but it has its drawbacks for people wanting to jump ship from Apache. To make the rewrite rules work, I had to: learn how to configure lighttpd, learn how use mod_magnet plugin because you need to learn LUA scripting language; and after all these, in the end, I hat to figure out how to convert Apache rules to LUA.

Also, there’s a big warning on lighttpd wiki:

“Keep in mind that the magnet is executed in the core of lighty. EVERY long-running operation is blocking ALL connections in the server. You are warned. For time-consuming or blocking scripts use mod_fastcgi and friends.”

which I don’t know how to interpret but sounds very scary [even if down below, they say the script is cached]. But I sure do not want to have all the connections to the servers blocked!

Please use the forum if you need aditional information, I’ll try to answer as soon as possible.