Exhibit HN: PageSpeed for Nginx – Unusual Debian Packages

In 2012, Google released model 1.0 of their PageSpeed modules for NGINX and Apache. It has long past largely overlooked since then. The immediate of PageSpeed is that after you add it to your web server, that you just would possibly maybe additionally configure it to optimize one thing passing thru it utilizing ways much like minification, format conversion, and even injecting scripts to lazy-load photos. That you would possibly perchance read more about what it does on the reputable situation.

It sounded mountainous in opinion, but how neatly install it with NGINX wasn’t glaring. While Google does submit scripts to attend with the installation, it requires a non-trivial depth of files to enact stunning. After combating it for numerous hours, I wrote a files for private future reference.

I honest no longer too long within the past returned to these notes to thoroughly automate the process utilizing GitHub Actions. The work is commence-source and on hand on GitHub.

Set up

Bolt the next as root on a Debian-essentially essentially based machine:

sudo su
appropriate-key adv --keyserver keyserver.ubuntu.com --recv-keys 8028BE1819F3E4A0
echo "deb https://nginx-pagespeed.knyz.org/dist/ /" > /etc/appropriate/sources.listing.d/nginx-pagespeed.listing
echo "Kit: *" > /etc/appropriate/preferences.d/99nginx-pagespeed
echo "Pin: foundation http://nginx-pagespeed.knyz.org/" >> /etc/appropriate/preferences.d/99nginx-pagespeed
echo "Pin-Priority: 900" >> /etc/appropriate/preferences.d/99nginx-pagespeed
appropriate replace
appropriate install nginx-beefy # If NGINX is already installed, an `appropriate strengthen` works too
echo "pagespeed on;" > /etc/nginx/conf.d/pagespeed.conf
echo "pagespeed FileCachePath "/var/cache/pagespeed/";" >> /etc/nginx/conf.d/pagespeed.conf
echo "pagespeed FileCacheSizeKb 102400;" >> /etc/nginx/conf.d/pagespeed.conf
echo "pagespeed FileCacheCleanIntervalMs 3600000;" >> /etc/nginx/conf.d/pagespeed.conf
echo "pagespeed FileCacheInodeLimit 500000;" >> /etc/nginx/conf.d/pagespeed.conf
echo "pagespeed RewriteLevel CoreFilters;" >> /etc/nginx/conf.d/pagespeed.conf

systemctl reload nginx

The installation process is explained more totally on the GitHub page as soon as you’re peculiar.


As soon as that is performed, you can personal an active NGINX + PageSpeed installation that can receive the equivalent updates as upstream NGINX. That you would possibly perchance be taught more about person filters you can additionally enable within the documentation.

Be half of the pack! Be half of 8000+ others registered customers, and accumulate chat, personal groups, put up updates and personal company world wide!


1 Comment

  1. Surprisingly few people seem to have heard of modpagespeed which I think can be attributed to an absence of packages coupled with the difficulty of installation.

    I knew I had to build something like this the day GitHub actions came out, but haven't gotten around to it until the holidays!

    While this HN thread is quite old now, it still provides some context on what it's all about: https://news.ycombinator.com/item?id=11018861

    GitHub repository with sources here: https://github.com/knyzorg/nginx-pagespeed

    More information available on the modpagespeed website: https://www.modpagespeed.com/