Blog Engine Overhaul – Nginx + Google Pagespeed Module

First off…a warning, do not run anything you don’t understand, because I sharing a script that does the Pagespeed module compiling and installation almost automatically.

Google Page Speed
Google Page Speed

I run my own WordPress on Digital Ocean for the flexibility of installing modules and stuff, but I didn’t get down to really optimising things until recently. Well…actually it’s mostly for trying out stuff. My setup here is :

  1. VM with Debian ‘Wheezy’
  2. Nginx from the official nginx repository

For the optimisation, one of the things to try is Google PageSpeed. PageSpeed is a module that sits with your web server, either Apache or Nginx and does on-the-fly optimisation when people visits your site. So for compiling PageSpeed, you will need gcc4.8 and above. That’s not available for Wheezy, so I had to upgrade to Jessie. With Jessie, the official repo from nginx will install nginx 1.10. Here comes the script. There’s a git repo that has a script to rebuild nginx + pagespeed. So again, I repeat, do not run anything you don’t understand, even if I have already did. Make it a habit. https://gist.github.com/Geekfish/7433322 This script does the following.

  1. Download the source from nginx repo – i.e. the command apt-get source nginx
  2. Download the Pagespeed stuff etc
  3. Modify debian/rules inside the source package
  4. Compile nginx with PageSpeed.

In this script, the parameters are hardcoded to ‘squeeze’, so it will download nginx 1.6. So take a look at the script and edit all references of ‘squeeze’ and change it to ‘jessie’. That will get you a newer version of nginx. You would otherwise get nginx 1.6. After changing the references, run the script. Here are the steps if you do not want to do the editing part.

git clone https://gist.github.com/Geekfish/7433322
 
cd 7433322
 
perl -pi -e 's/squeeze/jessie/g' rebuld_nginx_with_pagespeed.sh
 
chmod 700 rebuld_nginx_with_pagespeed.sh
 
./rebuld_nginx_with_pagespeed.sh

And wait. The script will also install the dependencies, so if everything is successful, then you see the message prompting you to install the compiled packages. Enjoy!

Author: yibi

YiBi's numb :) YiBi writes about anything. Technology, Gossips, Rubbish YiBi's a half f%#k geek :P

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Optimization WordPress Plugins & Solutions by W3 EDGE