news
Serverspace has added a new Rocky Linux OS
JH
Joe Harris
January 19, 2021
Updated June 7, 2023

How to Set Up Google PageSpeed Module in Apache on CentOS 8

CentOS Linux Web server

Using another OS?

Select the desired version or distribution.

The PageSpeed module is designed to optimize the web server and speed up its response. In this tutorial, we will set up the Google PageSpeed module in Apache on CentOS 8. First, you need to have a CentOS 8 server with the Apache web server installed.

In the Serverspace you can create a server with already installed app "Apache".

Downloading and installing the Google PageSpeed module

To install the Google PageSpeed module, you need the at and wget packages.

dnf install at wget

Download Google PageSpeed package for Apache.

wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm

Install the PageSpeed module itself.

rpm -U mod-pagespeed-*.rpm

Restart Apache.

systemctl restart httpd

Set up the Google PageSpeed module

At this point, the PageSpeed module is already working together on the Apache web server. You can change the optimization settings. To do this, open the file:

nano /etc/httpd/conf.d/pagespeed.conf

It is worth changing the settings only if you understand well what you are doing. The module is set to optimal values by default. Here are some examples of settings. To disable the PageSpeed module, find ModPagespeed and change its value to off.

ModPagespeed off

You can change the cache storage path. It is specified in the following parameter:

ModPagespeedFileCachePath

And the path for storing logs:

ModPagespeedLogDir

If you have made any changes to the settings, restart Apache.

systemctl restart httpd

Accessing the PageSpeed web interface

The PageSpeed module has its own web interface that displays statistics and information on settings. By default, access to the web interface is allowed only from the local server. To change this setting, open the file again:

nano /etc/httpd/conf.d/pagespeed.conf

Find the following section almost at the very end of the file:

<Location /pagespeed_admin>

Add a new Allow from directive with the IP address or subnet from which you want to access the web interface:

<Location /pagespeed_admin>
...
Allow from 10.5.5.0/24
...
</Location>

Restart Apache.

systemctl restart httpd

Now enter the following address in your browser, replacing “Server-IP” with your server's address.

http://Server-IP/pagespeed_admin

Vote:
4 out of 5
Аverage rating : 4.8
Rated by: 5
1101 CT Amsterdam The Netherlands, Herikerbergweg 292
+31 20 262-58-98
700 300
ITGLOBAL.COM NL
700 300
We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.