Install Apache mod_pagespeed Module On CWP (Centos Web Panel)

mod_pagespeed is an open-source Apache module created by Google to help Make the Web Faster by rewriting web pages to reduce latency and bandwidth. mod_pagespeed is an open-source Apache module which automatically applies web performance best practices to pages, and associated assets (CSS, JavaScript, images) without requiring that you modify your existing content or workflow.

Let’s get started with the installation.

For this demonstration CentOS 7 installed on KVM VPS with Centos Web Panel.

1 Create a directory and use that directory to download mod_pagespeed
# mkdir /usr/local/src/mod_pagespeed
# cd /usr/local/src/mod_pagespeed
2. Download mod_pagespeed:
# wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm
# rpm2cpio mod-pagespeed-stable_current_x86_64.rpm | cpio -idmv
3. Copy mod_pagespeed.so and mod_pagespeed_ap24.so into Apache module directory
# cp /usr/local/src/mod_pagespeed/usr/lib64/httpd/modules/mod_pagespeed.so /usr/local/apache/modules/

# cp /usr/local/src/mod_pagespeed/usr/lib64/httpd/modules/mod_pagespeed_ap24.so /usr/local/apache/modules/
4. Download pagespeed.conf from CWP and copy it into Apache conf directory
# wget –output-document=”/usr/local/apache/conf.d/pagespeed.conf” http://dl1.centos-webpanel.com/files/apache/mods/pagespeed/pagespeed.conf

# cp /usr/local/src/mod_pagespeed/etc/httpd/conf.d/pagespeed_libraries.conf /usr/local/apache/conf/
5. Set the permission
# chmod 755 /usr/local/apache/modules/mod_pagespeed.so
# chmod 755 /usr/local/apache/modules/mod_pagespeed_ap24.so
6. Now, create a directory for cache and change the ownership of the directory:
# mkdir -p /var/cache/mod_pagespeed/
# chown -R nobody:nobody /var/cache/mod_pagespeed/
7. Restart Apache to reflect the changes
# service httpd restart

That’s it, we have successfully install Apache mod_pagespeed module on CWP.

Leave a Reply

Your email address will not be published. Required fields are marked *