Compile and Install Nginx With the PageSpeed Module on Debian 8

In this article, we will see how to compile and install Nginx mainline from the official sources of Nginx with the PageSpeed module, which allows you to accelerate your website through several filters. These filters act on HTML, images, CSS or Javascript.


  • A newly deployed Vultr instance running Debian 8.
  • A sudo user.

Manual installation

Update the system.

sudo apt-get updatesudo apt-get dist-upgrade

Install dependencies.

sudo apt install build-essential ca-certificates zlib1g-dev libpcre3 libpcre3-dev tar unzip libssl-dev

Define a variable with the latest version of the PageSpeed module.


Next, we need to download and extract the source code for ngx-pagespeed.

cd /optwget${NPS_VER}-beta.zipunzip v${NPS_VER}-beta.ziprm v${NPS_VER}-beta.zipcd ngx_pagespeed-${NPS_VER}-betapsol_url=${NPS_VERSION}.tar.gz[ -e scripts/ ] && psol_url=$(scripts/ PSOL_BINARY_URL)wget ${psol_url}tar -xzvf $(basename ${psol_url})rm ${NPS_VER}-x64.tar.gz

Compilation and installation of Nginx

Define a variable with the latest version of Nginx.


Or define it via the Nginx website.

NGINX_VER=$(curl -s | awk 'NR==2' | awk '{print $4}')

Next, we need to download the source code for Nginx.

cd /optwget -qO-${NGINX_VER}.tar.gz | tar zxf -

Configure the parameters and modules. The Nginx PageSpeed module is included.

cd nginx-${NGINX_VER}./configure /--prefix=/etc/nginx /--sbin-path=/usr/sbin/nginx /--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 /--user=nginx /--group=nginx /--without-http_ssi_module /--without-http_scgi_module /--without-http_uwsgi_module /--without-http_geo_module /--without-http_map_module /--without-http_split_clients_module /--without-http_memcached_module /--without-http_empty_gif_module /--without-http_browser_module /--with-threads /--with-file-aio /--with-http_ssl_module /--with-http_v2_module /--with-ipv6 /--with-http_mp4_module /--with-http_auth_request_module /--with-http_slice_module /--add-module=/opt/ngx_pagespeed-release-${NPS_VER}-beta


make -j $(nproc)


make install

You can verify that the ngx_pagespeed module has been added to Nginx installation as follows.

/usr/local/nginx/sbin/nginx -V

Automatic installation

Get the automation script, which allows you to install several modules, including the PageSpeed module.

wget --no-check-certificate -O

Make it executable.

chmod +x

Execute it.


Your Nginx PageSpeed module installation is now complete.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article

No comments

Powered by Blogger.