Table of Contents

PageSpeed

Note: These instructions are out-of-date and may no longer be applicable.

Building and using Google PageSpeed with Nginx on Debian Jessie

sudo apt-get install dpkg-dev build-essential zlib1g-dev libpcre3 libpcre3-dev unzip 
sudo apt-get build-dep nginx
 
export _nginx_ver=1.6.2
export _nps_ver=1.9.32.3
export _buildroot=/usr/src/nginx-${_nginx_ver}-nps-${_nps_ver}-build
 
sudo mkdir $_buildroot
cd $_buildroot
sudo apt-get source nginx
cd ${_buildroot}/nginx-${_nginx_ver}/debian/modules
sudo wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${_nps_ver}-beta.zip
sudo unzip release-${_nps_ver}-beta.zip
sudo mv ngx_pagespeed-release-${_nps_ver}-beta/ ngx_pagespeed
cd ngx_pagespeed
sudo wget https://dl.google.com/dl/page-speed/psol/${_nps_ver}.tar.gz
sudo tar xzvf ${_nps_ver}.tar.gz
 
# add build rules
 
sudo vi ${_buildroot}/nginx-${_nginx_ver}/debian/rules
 
# add: --add-module=$(MODULESDIR)/ngx_pagespeed to the common_configure_flags section
 
# update changelog info
sudo vi ${_buildroot}/nginx-${_nginx_ver}/debian/changelog
 
# add something along these lines (append nps to pkg version):
#
#nginx (1.6.2-5-nps) unstable; urgency=medium
#
#  * Rebuild of backports with ngx_pagespeed 1.9.32.3.
#
# -- Gabriel O'Brien <gabriel@quay.net>  Thu, 30 Mar 2015 15:33:42 -0400
 
cd ${_buildroot}/nginx-${_nginx_ver}
 
# workaround to building source package, the original distribution packages aren't registered correctly
sudo dpkg-buildpackage -b

Building and using Google PageSpeed with Nginx on Debian Wheezy Backports

sudo apt-get install dpkg-dev build-essential zlib1g-dev libpcre3 libpcre3-dev unzip
sudo apt-get -t wheezy-backports build-dep nginx
 
export _nginx_ver=1.6.2
export _nps_ver=1.9.32.3
export _buildroot=/usr/src/nginx-${_nginx_ver}-nps-${_nps_ver}-build
 
sudo mkdir $_buildroot
cd $_buildroot
sudo apt-get -t wheezy-backports source nginx
cd ${_buildroot}/nginx-${_nginx_ver}/debian/modules
sudo wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${_nps_ver}-beta.zip
sudo unzip release-${_nps_ver}-beta.zip
sudo mv ngx_pagespeed-release-${_nps_ver}-beta/ ngx_pagespeed
cd ngx_pagespeed
sudo wget https://dl.google.com/dl/page-speed/psol/${_nps_ver}.tar.gz
sudo tar xzvf ${_nps_ver}.tar.gz
 
# add build rules
# sudo vi ${_buildroot}/nginx-${_nginx_ver}/debian/rules
# add: --add-module=$(MODULESDIR)/ngx_pagespeed to the common_configure_flags section
 
# update changelog info
# sudo vi ${_buildroot}/nginx-${_nginx_ver}/debian/changelog
# add something along these lines (append nps to pkg version):
#
#nginx (1.6.2-5~bpo70+1-nps) wheezy-backports; urgency=medium
#
#  * Rebuild of backports with ngx_pagespeed 1.9.32.3.
#
# -- Gabriel O'Brien <gabriel@quay.net>  Fri, 06 Mar 2015 19:53:42 -0500
 
cd ${_buildroot}/nginx-${_nginx_ver}
sudo dpkg-buildpackage -b  # workaround to building source package, more investigation req'd

References

https://developers.google.com/speed/pagespeed/module

https://github.com/pagespeed/ngx_pagespeed

http://ngxpagespeed.com/ngx_pagespeed_example/