Recompiling nginx on Fedora to use Google pagespeed

Google Pagespeed is a nice minify module for nginx/apache, but in order to run on nginx it needs to be compiled into nginx from source. Luckily it’s not too hard.

Google’s directions

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

What I did


sudo yum install gcc-c++ pcre-dev pcre-devel zlib-devel make unzip
NPS_VERSION=1.9.32.1
wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${NPS_VERSION}-beta.zip
unzip release-${NPS_VERSION}-beta.zip
cd ngx_pagespeed-release-${NPS_VERSION}-beta/
wget https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz
tar -xzvf ${NPS_VERSION}.tar.gz # extracts to psol/
rpm -ivh https://dl.fedoraproject.org/pub/fedora/linux/updates/20/SRPMS/nginx-1.4.7-1.fc20.src.rpm

Edit /root/rpmbuild/SPECS/nginx.spec

Add to the configure command:

--add-module=/root/ngx_pagespeed-release-1.9.32.1-beta/ \

Rebuild and Install


rpmbuild -bb /root/rpmbuild/SPECS/nginx.spec
rpm -Uvh /root/rpmbuild/RPMS/x86_64/nginx-1.4.7-1.fc17.x86_64.rpm
service restart nginx

Leave a Reply

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