I found a way to upgrade nginx to another apt source that bundles ngx_pagespeed as a dynamic module that can be activated easily.
List of features and modules: nginx modules - deb.myguard.nl - Boost your webserver.
How to install: How to use - deb.myguard.nl (has a few instructions wrong)
Correct install instructions for Ubuntu:
cd /etc/apt/trusted.gpg.d/ wget https://deb.myguard.nl/pool/deb.myguard.nl.gpg . /etc/os-release echo "deb [arch=amd64] http://deb.myguard.nl $VERSION_CODENAME main" > /etc/apt/sources.list.d/deb.myguard.nl.list apt update
!!! Warning !!!: Do NOT upgrade yet. You could lose your ssh access here. This apt source provides updates to SSH (openssh-server), and the new update added 2 new configs:
20-security.conf that in my case disallowed my ssh public key algorithm, and I got error
Too many authentication failures on any login attempt.
When you upgrade, it’s very important to choose
keep your currently-installed version every time it asks you, and then DO NOT reload ssh service. First delete those 2 new configs, then reload.
apt upgrade # select "keep your currently-installed version" every time rm -f /etc/ssh/sshd_config.d/10-algorithms-ciphers.conf /etc/ssh/sshd_config.d/20-security.conf service ssh reload
apt update also updates nginx, in my case from
Now simply install pagespeed:
apt install libnginx-mod-pagespeed
Now you have 3 new snippets:
pagespeed-main must be loaded at the server level. To do this you can copy paste it’s content in
cat /etc/nginx/snippets/pagespeed-main.conf.example > /etc/nginx/conf.d/pagespeed.conf
Now you can activate pagespeed at a vhost level, with a custom nginx config like so: (you can also make a template if you want)
copy paste the contents from
nginx -t service nginx reload
Happy optimizing !