How to install ngx_pagespeed Module in ubuntu 14.04 where nginx server is already installed?

July 27, 2015 3.5k views
Caching Nginx LEMP Load Balancing

I followed the google developers website https://developers.google.com/speed/pagespeed/module/build_ngx_pagespeed_from_source but this page says that I need to install nginx from source but I already installed nginx on my droplet.
Could you please guide me step by step installation on ngx_pagespeed module on ubuntu 14.04 which already has nginx webserver,php5 fastcgi???

4 comments
  • Hey. Once this is already installed, it is not possible to compile it with the module thereafter. Also hopefully you are already aware that this mod has been officially donated by Google to Apache and that is the primary reason Google offers "Build From Source" code and for Apache it is pre-built!

    Yet if you want to compile it again, you only need to do this:

    sudo apt-get remove --purge nginx
    sudo apt-get autoremove
    sudo apt-get autoclean
    

    Once you have completely removed Nginx, then you will be required to follows steps as described on this page.

    Hope this helps!

    --
    Regards
    Saurabh

    Servopia.com
    Managed Cloud Hosting For PHP Applications On DigitalOcean IaaS

  • Saurabh is correct: you first have to remove the nginx installed by your package manager, and then build from source following the instructions you referenced.

    But I did just want to clear up a couple side things:

    • Google hasn't donated ngx_pagespeed to the Apache Foundation. Perhaps you're thinking of mod_spdy?
    • The reason we provide binary packages for Apache but not Nginx is that Apache supports loadable modules and Nginx doesn't. If Nginx adds support for packages we'll gladly prepare them.

    (I'm a developer on PageSpeed at Google.)

  • I tried the approach suggested by @saurabh but NGINX is not working after removing and building from source as described by google.

    when I try to restart nginx all I get is

    nginx-1.8.0:$ sudo service nginx status
    * nginx is not running
    nginx-1.8.0:$ sudo service nginx restart 
     * Restarting nginx nginx                                                                                                                                                                             [fail] 
    nginx-1.8.0:$ sudo service nginx status
     * nginx is not running
    

    Had to uninstall NGINX again, remove ngx-pagespeed, re-install nginx and replace /etc/nginx with a backup that I took before trying to install.

  • @jefftk

    My bad... It is modspdy and not modpagespeed that I referred to :)

    @rossmc

    Did you check Nginx error logs?

    If I may, why don't you try Nginx as reverse proxy for Apache webserver? Then mod_pagespeed can be easily installed as a package for Apache and your purpose solved :)

2 Answers

This question was answered by @jefftk:

Saurabh is correct: you first have to remove the nginx installed by your package manager, and then build from source following the instructions you referenced.

But I did just want to clear up a couple side things:

  • Google hasn't donated ngx_pagespeed to the Apache Foundation. Perhaps you're thinking of mod_spdy?
  • The reason we provide binary packages for Apache but not Nginx is that Apache supports loadable modules and Nginx doesn't. If Nginx adds support for packages we'll gladly prepare them.

(I'm a developer on PageSpeed at Google.)

You can see the comment here.

This question was answered by @saurabh:

Hey. Once this is already installed, it is not possible to compile it with the module thereafter. Also hopefully you are already aware that this mod has been officially donated by Google to Apache and that is the primary reason Google offers "Build From Source" code and for Apache it is pre-built!

Yet if you want to compile it again, you only need to do this:

sudo apt-get remove --purge nginx
sudo apt-get autoremove
sudo apt-get autoclean

Once you have completely removed Nginx, then you will be required to follows steps as described on this page.

Hope this helps!

--
Regards
Saurabh

Servopia.com
Managed Cloud Hosting For PHP Applications On DigitalOcean IaaS

You can see the comment here.

Have another answer? Share your knowledge.