Install Nginx, PageSpeed Mod, Naxsi WAF and Brotil Ubuntu

In this tutorial I’m going to show how to easily install and or update your existing Nginx server with Mod PageSpeed, Naxi WAF, Brotil compression on Ubuntu 18.04 server. First of all, let’s identify what are these additional modules.

PageSpeed Module for Nginx – This is a web server module which automatically optimizes your site (minify html, Javascript, CSS) optimizes images etc.

Naxsi – Is a Web Application Firewall. It provides protection against Anti XSS & SQL Injection. This module analyzes, filters, and secures the traffic. Naxsi is an alternative to Mod Security.

Brotil – This is a web data compression tool developed by the Google. It’s similar to popular Gzip, but it has better performance than Gzip. Default it it uses static compression (compressed assets save on disk)

Nginx Pagespeed mod

In this tutorial method you can install nginx first time on your server or you can update your existing nginx installation with these third party modules. This tool automatically compiles nginx with additional modules for you. You can just sit and wait until it’s complete.

How to install PageSpeed Mod, Naxsi and Brotil on Nginx Server.

First, you have to manually download and uncompress these required modules to /root/ directory.

Download Brotil Module.
Clone the ngx_brotil modules.

Now this package clone into your /root/ direcotory.

Download Naxsi WAF for Nginx.

Now download and unzip Naxsi WAF for Ubuntu 18.04. Just run the following command line on your terminal.

It will automatically download the compressed file to /root/ directory and uncompress it.

Now we are almost done. The next step installs the Nginx PageSpeed module. It’s an automated script which installs nginx latest version and other modules selected by you.

Install All modules with PageSpeed automated script.

Now download the Nginx PageSpeed module for Ubuntu 18.04. Just copy and paste following command line in your terminal.

Source: in here.

Now this script, download all the necessary packages for you.

During the build process, when its request to build with additional modules add all the required modules in a single line. (Not one by one). Like the following. This installation uses default nginx pagespeed configuration.

Next it will ask to build the nginx. Before that it will show the  logs directories, configuration files and etc.

Type “Y” for continue.

Once the nginx installed it shows following message.

Nginx installed with ngx_pagespeed support compiled-in.

If this is a new installation you probably need an init script to
manage starting and stopping the nginx service. See:

You’ll also need to configure ngx_pagespeed if you haven’t yet: