Main

Category Archives: Ops

Not too long ago, during a server migration, I decided to move from Apache to Nginx, mostly because I think it’s a fun weekend project and maybe a little bit because I was looking to save some memory on my VPS. After a few hiccups, Nginx was running smoothly, serving the blog and a few other things.

Hearing Steve Sounders (@Souders) and Ilya Grigorik (@igrigorik) from Google talk about PageSpeed at Velocity Conference made me think about it again. I had the PageSpeed module configured on Apache, but didn’t bother to set it up on Nginx after the migration.

Basically it does a lot of cool stuff, like minifying and combining JavaScript and CSS files, cache optimizations, inline resources, etc, everything directly on the web server layer, so you don’t have to worry about it at the application layer.

A complete list of filters that can be used with PageSpeed can be found at:

The only detail I would like to bring up is regarding other Nginx binaries on the same server. Since the install process involves downloading and compiling Nginx, not downloading a binary from a repository, I will probably end up with multiple copies on your server. To avoid confusion, I prefer to remove repository versions before starting the setup.

After compiling and installing a new Nginx with PageSpeed, you will also need to update your nginx.conf and vhosts. Again, everything is described in detail in the README file.

Recently I came up with a script to quickly print the memory utilization of specific processes on Linux. It’s very simple, but proven to be very handy while I was moving and tuning my VPSs. It quickly showed me that Apache was taking pretty much all my memory and motivated the migration to nginx.

It’s currently set to get the Resident Set Size (RSS), but you can easily change it to use Virtual Memory (VSZ). Just change ‘rss’ to ‘vsz’ in the ps commands. Also, you can add more processes to the script. Just add a new line and change the process name.