Moving from Apache to Nginx Web Server for better WordPress performance

Moving a WordPress site from Apache to Nginx isn’t easy, but is well worth the effort – if you are on a micro instance and memory is at a premium.

kermit_memeI’ve written multiple posts about optimizing my blog to increase speed (here, here, and here)… unfortunately, my web server continues to crash at least once a day (usually due to a spike in traffic).

I started looking to stripping out unnecessary Apache modules, but had too many problems identifying the required modules for WordPress. After 30 minutes of failed server re-starts, I decided to ditch Apache all together and install Nginx as my webserver.

While Apache is the most well know WordPress webserver, Nginx is growing in popularity (WordPress.com uses Nginx on their site). In order to get a clean install, I created a new t2.micro instance, installed Nginx (and php-fpm) and migrated my WordPress files over 1.

There isn’t a lot of documentation on Nginx: I spent most of my time referencing the instructions at the following sites:

The install wasn’t smooth sailing. I had a beast-of-a-time getting my permalinks to work, and I forgot to change a few of my settings in my wordpress.php conf file (which caused my server to constantly crash).

There are still a few things I need to reconfigure – W3 Total Cache works differently in Nginx, so I’ve ignored it. I also have yet to re-install my certificates for https.

All that being said, my website is as fast as it was when I started my blog – probably due to Nginx, as well as the lack of “bloat” on the server (old WordPress plugins and no MySQL install).

My other call-out is that the use of AWS RDS and an Elastic IP made the most complicated parts of the migration simple.

Footnotes

  1. This was less complicated because I already had my database in AWS RDS, so there was no need to migrate – or install – MySQL. Unfortunately, I forgot to migrate my plugins – which caused a royal mess when I went to my newly-migrated site for the first time.

Leave a Reply