Some of you may already have noticed, that this blog uses Wordpress as blog software. Nothing special about that I guess. As I mentioned before in January/February I moved my website from my old provide to a new one making some significant changes to the blog and it’s infrastructure.

I am in the web business since a couple of years and I already worked with a couple of servers. Like most of the others I worked most with the Apache web server. Which is still the work horse of the internet. But recently the nginx web server which is a lean, mean web serving machine. To get a little more experience with this product I decided to use it for my blog. The nginx web server already matured already 9 years and reached recently (12. April 2011) the version 1.0.0 (congratulations on this by the way ;-) ). But there are still some major differences between the Apache and the nginx web servers.For me this started when I wanted to use Wordpress which is build upon PHP. PHP itself depends on the common gateway interface (a.k.a. CGI) which is a long time component of the Apache web server. Unfortunately the nginx server does not support CGI so you’ll have cover some more basics.

nginx itself supports CGI using the fast CGI standard. Which does actually a little bit more the plan CGI. To serve fast CGI you may use the nginx fast CGI module, so you still have access to all the scripting languages you like. But be aware that the nginx web server is known for it’s fabulous capabilities serving static content.

After installing nginx, a fast CGI wrapper app to execute the PHP scripts and configuring the fast CGI module, the setup of the Wordpress blog was pretty basic. I’m using a standard MySQL database backing the Wordpress. The whole system runs on a CentOS linux. The choice of the linux distribution was also inspired by the preferred system I use at my job for almost two years. Some times it’s good to stick to things you know ;-)

This was the status on which the whole system ran since February. But as a few - regarding to google analytics - of you may have noticed that the whole system was very slow. This is a direct result of my stinginess, because I don’t want to pay more money for my root server ;-)

So today I invested some spare time to look for other optimizations and I would like to say, that I was successful. My first search lead to a Wordpress plugin to cache the pre-rendered Wordpress pages. I have not this much posting and commenting traffic, so pre-rendering the pages seemed to be a good idea. The plugin of my choice is WP Super Cache which provides a very easy to configure caching of Wordpress pages. But I wanted to go one step further: The WP Super Cache plugin offer the possibility to bypass Wordpress and PHP completely by using compressed pre-rendered pages via mod_rewrite. I guess most of you noticed the problem: mod_rewrite is an Apache module, which does not work with the nginx server, but nginx provides a powerful rewriting module too. A very helpful blog post from the WP Super Cache author helped to configure the web server. And now - at least for any anonymous user - the site is fast.

It do no longer take about two seconds to return the the first bytes to the user and the page itself is compressed only approximately five kilobytes large. To speed up the perceived loading time of the page, I am using the Use Google Libraries plugin pass the delivery of standard Java Script libraries to google. So the libraries can participate on sharing between different pages and the long time expiry which is used by google. The plugin WP Minify joins and compresses the JS and CSS used by the theme and other plugins I use, so the browser does download only a few minimized files instead of dozens of CSS and JS files.

I can say, that the experiment was quite successful and after getting familiar with some peculiarities the setup process was quite easy.