I'm not able to install NGINX 1.15 with PageSpeed module

I’m running nginx 1.14 on Ubuntu 16.04 and I just installed 1.15 following the instructions from this Google page.

nginx -v still outputs v1.14

question is…how do I enable the new version with pagespeed?

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

If you want to run a custom version of nginx with a module like ngx_pagespeed compiled in, the safest way is to uninstall the default version of nginx first.

If you’re able to take this approach, try this:

  • Uninstall nginx with the commands: (or just start from a new Ubuntu 16.04 image)
sudo apt-get remove --purge nginx
sudo apt-get autoremove
sudo apt-get autoclean
bash <(curl -f -L -sS \
     --nginx-version latest
  • Partway through the installation, the script will ask you for nginx install options to include, here is a set that approximates the standard apt install nginx options:
--prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/ --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module
  • Now when you run nginx -v you should see 1.15.0 is installed but it’s not configured to run on startup yet

  • Create this systemd file at /lib/systemd/system/nginx.service and then run systemctl enable nginx to enable it and systemctl start nginx to start it.

You should now be able to confirm nginx is running via systemctl status nginx and you can edit nginx config at /etc/nginx/

Thank you very much. This is the complete configuration and it helps to reset all default nginx settings (like … location of nginx.conf, Home root folder …). Why do we need all these settings? because later on we need to install certbot to enable SSL, it can’t be done and many troubles without these settings.

--prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/ --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/ --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module

You may need to install addition certbot-nginx module. Assum you are using Centos: yum install -y certbot yum install -y certbot-nginx

again complied with nginx 1.15.2 problem fixed.