Adding mod_pagespeed in ea4 has been a feature request for years now so I thought to create a thread and as a community figure out how to install mod_pagespeed on our servers and most importantly, configure it.
So to install it you need to run the following on a root ssh:
That will install and enable mod_pagespeed on Apache 2.4 and above.
However, default configuration might cause all sorts of problems like excessive resource usage on the server, hogging up php-fpm pools etc. So the first thing I suggest you do is go on the PageSpeed config and disable it globally. You can enable it on a per domain or per subdomain basis using .htaccess or specific configurations for each account.
So to disable mod_PageSpeed globally you should do the following:
first make a backup copy of the default pagespeed configuration file:
Then go ahead and edit it:
I use nano as editor but you may want to use vi or another one of your choice.
In there add the following:
The <IfModule pagespeed_module> section is in the default config file and you need to change ModPageSpeed value to off and optionally change the value ModPagespeedFileCachePath
ModpagespeedLogDir, ModPagespeedMessageBufferSize and ModPagespeedEnableCachePurge are not set by default so you should add them. They will help a lot later.
Don't forget to restart httpd:
After that, mod_pagespeed is installed on the server and you can easily enable it on any domain by simply adding the following to it's .htaccess file:
----------------------------------------------------
Ok, so that basically is a good way to get started with installing and configuring mod_pagespeed.
Up till here, I'm fine but I'm having a problem completing some other steps.
When this guide is complete I will add [guide] at the title.
So to install it you need to run the following on a root ssh:
Code:
yum install rpm-build cpio ea-apache24-mod_version
wget https://github.com/pagespeed/cpanel/raw/master/EA4/ea-apache24-mod_pagespeed-latest-stable.src.rpm
rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm
rpm -ivh /root/rpmbuild/RPMS/x86_64/ea-apache24-mod_pagespeed*.rpm
/etc/init.d/httpd restart or service httpd restart
However, default configuration might cause all sorts of problems like excessive resource usage on the server, hogging up php-fpm pools etc. So the first thing I suggest you do is go on the PageSpeed config and disable it globally. You can enable it on a per domain or per subdomain basis using .htaccess or specific configurations for each account.
So to disable mod_PageSpeed globally you should do the following:
first make a backup copy of the default pagespeed configuration file:
Code:
cp /etc/apache2/conf.modules.d/456_pagespeed.conf /etc/apache2/conf.modules.d/456_pagespeed.conf.backup
Code:
nano /etc/apache2/conf.modules.d/456_pagespeed.conf
In there add the following:
Code:
<IfModule pagespeed_module>
ModPagespeed off
ModPagespeedFileCachePath "/var/mod_pagespeed/cache/default/"
ModpagespeedLogDir /var/log/pagespeed/default/
ModPagespeedMessageBufferSize 100000
ModPagespeedEnableCachePurge on
ModpagespeedLogDir, ModPagespeedMessageBufferSize and ModPagespeedEnableCachePurge are not set by default so you should add them. They will help a lot later.
Don't forget to restart httpd:
Code:
systemctl restart httpd
Code:
<IfModule pagespeed_module>
ModPagespeed on
</IfModule>
Ok, so that basically is a good way to get started with installing and configuring mod_pagespeed.
Up till here, I'm fine but I'm having a problem completing some other steps.
- Configure it with nginx. I use enginetron to implement nginx on my cpanel server (which I believe is the most common way to add nginx to a cpanel server) and mod_pagespeed has to be properly configured to run with nginx. Any attempt I made to change nginx config files to take advantage of mod_pagespeed resulted in errors. So I need a contribution to actually make it work.
- Enable the PageSpeed admin Console. That would be great. The guide here: webhostinghero.com/blog/cpanel-modpagespeed-installation/ does not help a lot. I suppose it's more of a general guide and not cpanel specific. Many thanks to the guys at webhostinghero for providing though. The first steps helped a lot.
When this guide is complete I will add [guide] at the title.
Last edited by a moderator: