Tutorials  /  Linux Basics

Compile Nginx with PageSpeed on Debian 8 for Faster Websites

Ccentron Redaktion · April 2025 ·3 min read ·Linux Basics, Tutorial

This step-by-step guide explains how to compile and install the latest mainline version of Nginx from source while integrating Google’s PageSpeed module. The PageSpeed module significantly enhances the performance of web applications by automatically applying intelligent optimizations. It minimizes HTML, compresses JavaScript and CSS files, and improves the delivery of image assets — all of which reduce latency and improve browser rendering. These enhancements are particularly useful for websites aiming to boost user experience, mobile performance, and SEO rankings.

Instead of using default package repositories, this approach provides developers and system administrators with full control over the compilation process. You decide which features and modules are included, allowing a streamlined, lightweight, and high-performing web server tailored to your needs. This guide is ideal for users who need custom builds, performance tuning, or compatibility with specific modules like ngx_pagespeed. By the end of this tutorial, you’ll have a customized Nginx installation optimized for speed and flexibility, ready to serve dynamic, efficient content across a wide range of use cases.

System Requirements

  • A Debian 8 server
  • A sudo-enabled user account
VM

Matching infrastructure at centron

No hardware needed to follow along: ccloud³ VMs with full root access start at €3.12 per month, billed by the hour and ready in seconds. Rent a cloud server →

Manual Installation Process

Update System Packages

Console
sudo apt-get update
sudo apt-get dist-upgrade

Install Required Dependencies

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

Download ngx_pagespeed and PSOL

Code
NPS_VER=1.13.35.2
cd /opt
wget https://github.com/pagespeed/ngx_pagespeed/archive/v${NPS_VER}-beta.zip
unzip v${NPS_VER}-beta.zip
rm v${NPS_VER}-beta.zip
cd ngx_pagespeed-${NPS_VER}-beta
psol_url=https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz
[ -e scripts/format_binary_url.sh ] && psol_url=$(scripts/format_binary_url.sh PSOL_BINARY_URL)
wget ${psol_url}
tar -xzvf $(basename ${psol_url})
rm ${NPS_VER}-x64.tar.gz

Set Nginx Version and Download Source

Code
NGINX_VER=1.9.9
cd /opt
wget -qO- http://nginx.org/download/nginx-${NGINX_VER}.tar.gz | tar zxf -

Configure, Compile and Install Nginx

Console
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/nginx.pid \
--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

Confirm Installation

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

Optional: Automated Script Installation

Console
wget --no-check-certificate https://raw.githubusercontent.com/Qoraiche/nginx-including-pagespeed/master/nginx-autoinstall.sh -O nginx-autoinstall.sh
chmod +x nginx-autoinstall.sh
./nginx-autoinstall.sh

Conclusion

By following this guide, you’ve learned how to manually compile and configure Nginx with the PageSpeed module on a Debian 8 system. This method gives you complete control over which modules are included, ensuring a custom fit for your environment. The resulting setup supports faster load times, improved performance, and better handling of optimized assets for modern websites.

Whether you chose the manual route for granular configuration or opted for the automatic installation script for convenience, you now have a high-performance Nginx instance running with Google’s powerful optimization tools built-in. This configuration is ideal for developers, sysadmins, and DevOps teams looking to maximize efficiency and control. With your server tuned for speed, you're well-equipped to support demanding applications and deliver top-tier user experiences across all devices.

Jetzt 200 € Guthaben sichern

Testen Sie Ihr Setup auf ccloud³

Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.

centron Redaktion Technische Redaktion

Das Redaktionsteam von centron schreibt Anleitungen aus dem Betriebsalltag: getestet auf unserer eigenen Plattform, betrieben im Rechenzentrum in Hallstadt bei Bamberg.

Kategorie Linux Basics
Teilen
Noch offene Fragen?

Our team will help you with your specific setup - in German or English, by people who run the platform themselves.

War dieses Tutorial hilfreich?

Your answer is stored anonymously and helps us improve our tutorials.

Kommentare

No comments yet - be the first to ask a question about this tutorial.

Sign in to comment

Comments are open to centron customers. Sign in to your account to ask a question about this tutorial.

Weiterlesen

Das könnte Sie auch interessieren

Jetzt kostenlos anfangen

Melden Sie sich an und erhalten Sie in den ersten 60 Tagen ein Guthaben von 200 € bei centron.

Dieses Werbeangebot gilt nur für neue Konten. Angebot ausschließlich für Gewerbetreibende.

Jetzt loslegen Sales kontaktieren