Nginx quicker than Apache2 on Raspberry Pi 2

Yesterday I setup my Raspberry Pi with Apache2 in the same manner I would for any Linux web server. My first impression was that it was slow to load my WordPress homepage. Installing APC as per The Perfect APC Configuration – Greg Rickaby improved load times but I was still seeking fast page load times.

After reading posts like The Raspberry Pi Web Server Speed Test – Raspberry Pi Blog and Raspberry Pi web server – Comparing the performance of Nginx and Apache web servers  I decided to install Nginx (pronounced engine-x). Being new to Nginx I used this Tutorial – Install Nginx and PHP on Raspbian – RaspiPress guide to do this inital configuration. I also used this guide to tweak Nginx for WordPress WordPress NGINX Rewrite Rules. First impressions of Nginx is that its fast and used far less memory.

Don’t forget to configure APC after installing Nginx as PHP caching does work to improve page load times.

Load testing and benchmarking is always a must when changing configurations on web servers. Look at apache – ab load testing – Stack Overflow and Load Testing and Benchmarking With Siege.

Can a Raspberry Pi 2 be a web server?

Over the past year I’ve been running a HP Proliant DL 38 G3 to host this website and other web apps. For the age of this server its a power house but this server consumes massive amounts of power using its two 575W power supplies.

Since the Raspberry Pi 2 model b was released I have been very interested on getting my hands on one. After receiving an excessive power bill I took the plunge and ordered my first Pi 2

With a 900 MHz quad core CPU and 1 GB RAM they pack some grunt in a small form-factor. The power saving is massive with a 2A micro USB charger using a mere  10W. Even if you used 2 or 3 Pi’s to run your website the power saving is huge.

Have a look at my awesome test bench. Still unsure of the type of case I want yet.

IMG_20150316_190108 IMG_20150316_190141

Currently I have one configured as a web server running Apache2/PHP5/APC and another running MySQL server. Not sure if a single web server will be enough grunt but time will tell. After performing some load tests I’m impressed on how well the Pi holds up.

If load becomes a real issue I’ll run a Pi with Varnish. I’ve used Varnish reverse web proxy in the past and its awesome at reducing web server load.

When I get my hands on some more Pi’s I’ll perform some bench marks comparing Apache2 and Nginx.

I’m sure you will see many more Pi related posts to come..