Installing Mod_Pagespeed from Source on Centos Web Panel [CWP]

What is Mod_PageSpeed:   PageSpeed improves web page latency and bandwidth usage by changing the resources on that web page to implement web performance best practices. Each optimization is...

2 Mins Read
714 Views

What is Mod_PageSpeed:

 

PageSpeed improves web page latency and bandwidth usage by changing the resources on that web page to implement web performance best practices. Each optimization is implemented as a custom filter in PageSpeed, which are executed when the HTTP server serves the website assets. Some filters simply alter the HTML content, and other filters change references to CSS, JavaScript, or images to point to more optimized versions.

PageSpeed implements custom optimization strategies for each type of asset referenced by the website, to make them smaller, reduce the loading time, and extend the cache lifetime of each asset. These optimizations include combining and minifying JavaScript and CSS files, inlining small resources, and others. PageSpeed also dynamically optimizes images by removing unused meta-data from each file, resizing the images to specified dimensions, and re-encoding images to be served in the most efficient format available to the user.

 

PageSpeed ships with a set of core filters designed to safely optimize the content of your site without affecting the look or behavior of your site. In addition, it provides a number of more advanced filters which can be turned on by the site owner to gain higher performance improvements.

 

PageSpeed can be deployed and customized for individual web sites, as well as being used by large hosting providers and CDNs to help their users improve performance of their sites, lower the latency of their pages, and decrease bandwidth usage.

 

How to Install in CWP:

 

1) Install missing dependencies.

sudo yum install gcc-c++ gperf make rpm-build -y

 

2) Install Python 2.7 as required by Chromium Depot Tools.

cd /usr/local/src
wget --no-check-certificate https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure --prefix=/usr/local
make && make altinstall

 

Installed Path:

/usr/local/bin/python

 

3) Install git 2.0.4 as required by Chromium Depot Tools.

cd /usr/local/src
wget https://www.kernel.org/pub/software/scm/git/git-2.0.4.tar.gz
tar -xf git-2.0.4.tar.gz
cd git-2.0.4/
./configure
make
sudo make install

 

Installed Path:

/usr/local/bin/git

 

4) Install the Chromium Depot Tools.

mkdir -p ~/bin
cd ~/bin
svn co http://src.chromium.org/svn/trunk/tools/depot_tools
export PATH=$PATH:~/bin/depot_tools

 

5) Check out mod_pagespeed and dependencies

mkdir ~/mod_pagespeed
cd ~/mod_pagespeed
gclient config http://modpagespeed.googlecode.com/svn/trunk/src
gclient sync --force --jobs=1

 

6) Install Mod_PageSpeed.

cd ~/mod_pagespeed/src
export SSL_CERT_DIR=/etc/pki/tls/certs
make AR.host=`pwd`/build/wrappers/ar.sh AR.target=`pwd`/build/wrappers/ar.sh BUILDTYPE=Release
cd install
chmod +x install_apxs.sh
APXS_BIN=/usr/local/apache/bin/apxs ./install_apxs.sh

 

6) Restart Apache.

service httpd restart

 

 

Important Paths and Permissions:

/usr/local/apache/modules/mod_pagespeed.so (root:root)
/usr/local/apache/modules/mod_pagespeed_ap24.so (root:root)
/usr/local/bin/pagespeed_js_minify (root:root)
/usr/local/apache/conf/pagespeed.conf (root:root)
/usr/local/apache/conf/pagespeed_libraries.conf (root:root)
/var/cache/mod_pagespeed (nobody:nobody)

 

If you want to enable mod_deflate then run the commands as below:

cd /usr/local/src/cwp/httpd-2.2.27/modules/filters/
/usr/local/apache/bin/apxs -i -c mod_deflate.c

 

If you want to enable mod_version then run the commands as below:

cd /usr/local/src/cwp/httpd-2.2.27/modules/metadata
/usr/local/apache/bin/apxs -i -c mod_version.c
Exit mobile version