Contents
Need an expert to help you with
" Install Mod_pagespeed Module With Apache on Ubuntu 16.04" ?

Get Help

Install Mod_pagespeed Module With Apache on Ubuntu 16.04

Install Mod_pagespeed module with Apache
Install Mod_pagespeed module with Apache

Introduction

Mod_pagespeed is an open source Apache module that is used to automatically optimize web pages. It focuses on making the web faster by rewriting web pages to reduce latency and bandwidth. Mod_pagespeed also provides many optimization filters which are used to optimize various files such as css, html, png, and jpg. In this tutorial we will teach you how to install and configure the ‘Mod_pagespeed’ module with Apache on Ubuntu 16.04

Prerequisites

  • A newly deployed Vultr Ubuntu 16.04 VPSinstance with Apache installed.
  • A non-root user with sudo privileges setup on your VPS.
  • A static IP address 192.168.15.110 configure on your system.

Step 1: Updating the System

Before starting, make sure to update your system to the latest version by running the command below.
sudo apt-get update -y
sudo apt-get upgrade -y
sudo reboot

Step 2: Install Mod_pagespeed

Now you can start downloading the latest version of ‘Mod_pagespeed’ module for Apache from the official site. You may also download it with the command below. wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb After the download has completed, you can install it by using the command below.
sudo dpkg -i mod-pagespeed-stable_current_amd64.deb
sudo apt-get install -f
When the installation is completed, you will need to restart Apache service to load the module.
sudo systemctl restart apache2
You can verify the ‘Mod_pagespeed’ module by typing the following ‘curl’ command.
sudo systemctl restart apache2
Once everything is a success, you are gonna see the next output.
HTTP/1.1 200 OK
Date: Mon, 28 Nov 2016 15:28:51 GMT
Server: Apache/2.4.7 (Ubuntu)
Accept-Ranges: bytes
Vary: Accept-Encoding
X-Mod-Pagespeed: 1.11.33.2-0
Cache-Control: max-age=0, no-cache
Content-Length: 10724
Content-Type: text/html; charset=UTF-8

Step 3: Configure the Mod_pagespeed module

There are different ways to configure the ‘Mod_pagespeed’ module. You could use the default ‘pagespeed.conf’ file to configure it for the entire server. Begin by editing the default ‘pagespeed.conf’ file.
sudo nano /etc/apache2/mods-available/pagespeed.conf
You can disable the ‘Mod_pagespeed’ module by changing the line below from ‘on’ to ‘off’ or the other way around.
ModPagespeed off
Mod_pagespeed is using several different types of levels to make the configuration simple such as PassThrough, Corefilters, and OptimizeForBandwidth. The default setting is as below.
ModPagespeedRewriteLevel CoreFilters
You can disable Corefilters by changing the line to the following.
ModPagespeedRewriteLevel PassThrough
If you would like to enable additional filters, use the below.
ModPagespeedEnableFilters filter1 filter2
You can also disable the filter with the following.
ModPagespeedDisableFilters filter1 filter2

Step 4: Access Mod_pagespeed web interface

’Mod_pagespeed’ module will provide a web based interface to view your server’s state. You will need to add the remote machine’s IP address in the ‘pagespeed.conf’ file to be able to access it from a remote machine.
sudo nano /etc/apache2/mods-available/pagespeed.conf
Next, change the file to look like the following.
<Location /pagespeed_admin>
 Order allow,deny
 Allow from localhost
 Allow from 127.0.0.1
 Allow from remote-ip-address
 SetHandler pagespeed_admin
</Location>

<Location /pagespeed_global_admin>
 Order allow,deny
 Allow from localhost
 Allow from 127.0.0.1
 Allow from remote-ip-address
 SetHandler pagespeed_global_admin
</Location>
Save the file before restarting your Apache service.
sudo systemctl restart apache2
Now you can open your browser at any time and type the URL ‘http://192.168.15.110/pagespeed_admin’ to access the ‘Mod_pagespeed’ web interface. Mod_pagespeed is now installed and configured on your VPS.
Updated on 08 Aug 2017
0 Comments
Add a comment
Login for Comment