AndreiC.
09-22-2025, 06:05 AM
Everyone wants a faster website. It's crucial for user experience and SEO. While NGINX is a powerhouse web server, getting it to work with the most powerful optimization modules is a huge challenge. Google's fantastic ngx_pagespeed module, which automatically optimizes your site on the fly, was abandoned years ago and is incompatible with modern NGINX versions.
This leaves you with a tough choice: run an old, insecure version of NGINX just to use PageSpeed, or upgrade to a modern, secure version and lose out on incredible automatic optimizations.
But what if you didn't have to choose?
The Solution: A Modern, Pre-Compiled NGINX Package
The team at ENGINYRING (https://www.enginyring.com) has solved this problem. They have patched the ngx_pagespeed source code to be fully compatible with the latest NGINX (1.29.1), included superior Brotli compression, and packaged it all into a single, easy-to-install .deb file.
This means you can get a state-of-the-art web server running on your vps hosting (https://www.enginyring.com/en/virtual-servers) in minutes, without any of the headaches of compiling from source.
Step-by-Step Installation Guide
Step 1: Prepare Your System
First, connect to your server via SSH. It's always a good idea to make sure your system is fully up-to-date.
sudo apt update && sudo apt upgrade -y
Step 2: Download the ENGINYRING Nginx Package
Next, download the custom .deb package directly from the official GitHub repository.
wget https://github.com/ENGINYRING/nginx-with-pagespeed/releases/download/v1/nginx-with-pagespeed_1.29.1-1_amd64.deb
Step 3: Install the Package
Use the dpkg command to install the package. This will install NGINX 1.29.1 and all the custom modules.
sudo dpkg -i nginx-with-pagespeed_1.29.1-1_amd64.deb
After it finishes, you can verify that the custom modules are included.
nginx -V
You should see --add-module=../ngx_brotli and --add-module=../ngx_pagespeed-1.13.35.2-stable in the output.
Step 4: Enable Brotli
Open your main NGINX configuration file to turn on Brotli.
sudo nano /etc/nginx/nginx.conf
Inside the http { ... } block, add the following lines:
##
Brotli Settings
brotli on;
brotli_comp_level 6;
brotli_static on;
brotli_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
Step 5: Enable ngx_pagespeed
First, create a cache directory for PageSpeed and give the NGINX user ownership of it.
sudo mkdir -p /var/ngx_pagespeed_cache
sudo chown www-data:www-data /var/ngx_pagespeed_cache
Next, create a separate configuration file for your PageSpeed settings to keep things clean.
sudo nano /etc/nginx/pagespeed.conf
Paste the following configuration into this file. This enables a set of core filters that are safe for most websites.
# Main pagespeed settings
pagespeed on;
pagespeed FileCachePath /var/ngx_pagespeed_cache;
Core filter set
pagespeed CoreFilters on;
Additional safe filters
pagespeed EnableFilters rewrite_style_attributes;
pagespeed EnableFilters extend_cache;
pagespeed EnableFilters combine_javascript;
pagespeed EnableFilters combine_css;
Ensure pagespeed works behind a proxy (like Cloudflare)
pagespeed RespectVary on;
Finally, open your website's server block configuration (e.g., /etc/nginx/sites-available/yourdomain.com) and add the following line inside the server { ... } section:
include /etc/nginx/pagespeed.conf;
Step 6: Test and Reload NGINX
Always test your configuration for errors before applying it.
sudo nginx -t
If the test is successful, reload NGINX to make your changes live.
sudo systemctl reload nginx
That's it! Your site is now being served by a cutting-edge web server, using Brotli for compression and PageSpeed for automatic optimization. You can check your site's response headers in your browser's developer tools to see the X-Page-Speed and content-encoding: br headers at work.
This leaves you with a tough choice: run an old, insecure version of NGINX just to use PageSpeed, or upgrade to a modern, secure version and lose out on incredible automatic optimizations.
But what if you didn't have to choose?
The Solution: A Modern, Pre-Compiled NGINX Package
The team at ENGINYRING (https://www.enginyring.com) has solved this problem. They have patched the ngx_pagespeed source code to be fully compatible with the latest NGINX (1.29.1), included superior Brotli compression, and packaged it all into a single, easy-to-install .deb file.
This means you can get a state-of-the-art web server running on your vps hosting (https://www.enginyring.com/en/virtual-servers) in minutes, without any of the headaches of compiling from source.
Step-by-Step Installation Guide
Step 1: Prepare Your System
First, connect to your server via SSH. It's always a good idea to make sure your system is fully up-to-date.
sudo apt update && sudo apt upgrade -y
Step 2: Download the ENGINYRING Nginx Package
Next, download the custom .deb package directly from the official GitHub repository.
wget https://github.com/ENGINYRING/nginx-with-pagespeed/releases/download/v1/nginx-with-pagespeed_1.29.1-1_amd64.deb
Step 3: Install the Package
Use the dpkg command to install the package. This will install NGINX 1.29.1 and all the custom modules.
sudo dpkg -i nginx-with-pagespeed_1.29.1-1_amd64.deb
After it finishes, you can verify that the custom modules are included.
nginx -V
You should see --add-module=../ngx_brotli and --add-module=../ngx_pagespeed-1.13.35.2-stable in the output.
Step 4: Enable Brotli
Open your main NGINX configuration file to turn on Brotli.
sudo nano /etc/nginx/nginx.conf
Inside the http { ... } block, add the following lines:
##
Brotli Settings
brotli on;
brotli_comp_level 6;
brotli_static on;
brotli_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
Step 5: Enable ngx_pagespeed
First, create a cache directory for PageSpeed and give the NGINX user ownership of it.
sudo mkdir -p /var/ngx_pagespeed_cache
sudo chown www-data:www-data /var/ngx_pagespeed_cache
Next, create a separate configuration file for your PageSpeed settings to keep things clean.
sudo nano /etc/nginx/pagespeed.conf
Paste the following configuration into this file. This enables a set of core filters that are safe for most websites.
# Main pagespeed settings
pagespeed on;
pagespeed FileCachePath /var/ngx_pagespeed_cache;
Core filter set
pagespeed CoreFilters on;
Additional safe filters
pagespeed EnableFilters rewrite_style_attributes;
pagespeed EnableFilters extend_cache;
pagespeed EnableFilters combine_javascript;
pagespeed EnableFilters combine_css;
Ensure pagespeed works behind a proxy (like Cloudflare)
pagespeed RespectVary on;
Finally, open your website's server block configuration (e.g., /etc/nginx/sites-available/yourdomain.com) and add the following line inside the server { ... } section:
include /etc/nginx/pagespeed.conf;
Step 6: Test and Reload NGINX
Always test your configuration for errors before applying it.
sudo nginx -t
If the test is successful, reload NGINX to make your changes live.
sudo systemctl reload nginx
That's it! Your site is now being served by a cutting-edge web server, using Brotli for compression and PageSpeed for automatic optimization. You can check your site's response headers in your browser's developer tools to see the X-Page-Speed and content-encoding: br headers at work.