Google Pagespeed on existent Nginx

June 25, 2014 4.7k views

I'm not an experienced Linux user, and I was trying to get google pagespeed working with an existent nginx sever.

I know I must recompile nginx with the module, but I couldn't get it working, all I had at the moment is a production server, so after some hours trying I've had to give up and get the server live again with a simple nginx install.

I had this page as a guide.

1 comment
4 Answers

Hello erick.

You can find some useful information in the official documentation of PageSpeed in Google Developer Channel: <a href="https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source?hl=ja">https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source?hl=ja</a>

Also, we have a basic tutorial from DO community: <a href="https://www.digitalocean.com/community/tutorials/how-to-add-ngx_pagespeed-module-to-nginx-in-debian-wheezy">https://www.digitalocean.com/community/tutorials/how-to-add-ngx_pagespeed-module-to-nginx-in-debian-wheezy</a>

Fell free to follow this tutorials. For a better result, i recoomend to study linux basics and learn how to work with folder, permissions, scripting and so on.. You can archive better results for your needs.

by Saleh Salem
In this tutorial, you are going to add ngx_pagespeed module to nginx by building it from Debian wheezy backport source, because Debian backports repository has a more recent nginx version than the stable repository, which is at the time of writing this tutorial version 1.4.4.

Hey Erick!

If you could share the actual problems that you're running into, we'd probably be better able to help. Were there errors when you were trying to compile it? Are you have problems with configuration? Let us know!

Hi astarr,

I could recompile w/o errors, but it didnt replace the running nginx, I've tried uninstall the nginx and recompile/install, but it didn't install, I wasn't able to start/stop etc.

Do I need add args on this line?

./configure --add-module=$HOME/ngx_pagespeed-release-${NPS_VERSION}-beta

I got the args from the running one and add to it.

Thanks for the reply, ;)

When you install it via the instructions on the Google site, all the files end up in /usr/local/nginx/ So, the nginx command is /usr/local/nginx/sbin/nginx and the configuration files are in /usr/local/nginx/conf/

If you want to install it to the location that the packaged version is normally installed to, you can add a number of extra arguments to ./configure

--prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf \ 
--sbin-path=/usr/sbin --error-log-path=/var/log/nginx/error.log

Though, I suggest you take a look at the post Alexandre linked to. Especially if you're doing this on your live production server, it probably makes sense to build Debian packages that will cleanly replace the ones you have installed.

by Saleh Salem
In this tutorial, you are going to add ngx_pagespeed module to nginx by building it from Debian wheezy backport source, because Debian backports repository has a more recent nginx version than the stable repository, which is at the time of writing this tutorial version 1.4.4.
Have another answer? Share your knowledge.