The PageSpeed modules are open-source server modules that optimize your site automatically.
If you haven’t guessed it, this module directly complements Google’s PageSpeed Insights. It’s a great tool for giving you feedback on what can be done to optimize your site. What I’ve found is many of the issues this tool reports back to you can be resolved automatically by the PageSpeed module , Simply by installing it. Google can tell you what needs to be optimized and how to optimize it, so why not let them do it for you?
Combine/minify CSS & JavaScript
Flatten CSS @imports
Optimize images
Extend cache
Collapse Whitespace
Lazily Load Images
Move CSS to Head
Move CSS Above Scripts
Installation Procedure (CentOS):
- 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
"RPM build errors:
File must begin with "/": %{_httpd_moddir}/*.so
File must begin with "/": %{_httpd_modconfdir}/*.conf"
Just create a file named "macros.apache2" in '/etc/rpm/ directory and paste the below content into that and then restart from step 3.
%_httpd_mmn 20120211x8664
%_httpd_apxs /usr/bin/apxs
%_httpd_dir /etc/apache2
%_httpd_bindir %{_httpd_dir}/bin
%_httpd_modconfdir %{_httpd_dir}/conf.modules.d
%_httpd_confdir %{_httpd_dir}/conf.d
%_httpd_contentdir /usr/share/apache2
%_httpd_moddir /usr/lib64/apache2/modules
2- you may face following error:
"rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm
Installing ea-apache24-mod_pagespeed-latest-stable.src.rpm
error: ea-apache24-mod_pagespeed-latest-stable.src.rpm cannot be installed"
Just look at your screen , go 1 step back and check the downloaded file name in some case may be different most of people just run " rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm" command but sometimes file name can be different for example may be file saved as ea-apache24-mod_pagespeed-latest-stable.src.rpm.9 so in this case you should change file name in command before running that for above example just add .9 in end of command
rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm.9
Now Login into your WHM panel > Software > EasyApache4 and look for "mod_pagespeed" option and enable it after that restart apache again and run insight then check your website speed performance!
Configuring Google mod_pagespeed
The installation script will copy "pagespeed.conf" file into " /usr/local/apache/conf/ " or " /etc/apache2/conf.modules.d" on your server. Please consult the following pages to customize your mod_pagespeed configuration:mod_pagespeed module configuration
configuring mod_pagespeed filters
For example of the different filters in action and detailed documentation for each, please see https://modpagespeed.com/doc/
Hi! I'm getting an error on this command: rpmbuild --rebuild ea-apache24-mod_pagespeed-latest-stable.src.rpm
ReplyDeleteRPM build errors:
File must begin with "/": %{_httpd_moddir}/*.so
File must begin with "/": %{_httpd_modconfdir}/*.conf
Just create a file called '/etc/rpm/macros.apache2' and paste the below content into that:
Delete%_httpd_mmn 20120211x8664
%_httpd_apxs /usr/bin/apxs
%_httpd_dir /etc/apache2
%_httpd_bindir %{_httpd_dir}/bin
%_httpd_modconfdir %{_httpd_dir}/conf.modules.d
%_httpd_confdir %{_httpd_dir}/conf.d
%_httpd_contentdir /usr/share/apache2
%_httpd_moddir /usr/lib64/apache2/modules
How to create the file? thanks for your help!
DeleteI also got the following error.
DeleteRPM build errors:
File must begin with "/": %{_httpd_moddir}/*.so
File must begin with "/": %{_httpd_modconfdir}/*.conf
Then i created '/etc/rpm/macros.apache2' and saved with the contents you provided. And restart from #3. But again i ended up with the same error. Please help.
good
ReplyDeleteHow to uninstall mod_pagespeed from EasyApache4 ?
ReplyDeleteLogin into your WHM panel > Software > EasyApache4 from
DeleteCurrently Installed Packages select customize > Apache Modules , look for "mod_pagespeed" option and disable it and then click provision.
Assalamu aleykum
ReplyDeleteApreciate your work.
After install, see /etc/apache2/conf.modules.d/456_pagespeed.conf, and see pagespeed module on EA4 installed but not work.
curl -I tamainut.com
HTTP/1.1 301 Moved Permanently
Date: Thu, 27 Apr 2017 05:45:37 GMT
Server: Apache
Location: https://tamainut.com/
Cache-Control: max-age=0, public
Expires: Thu, 27 Apr 2017 05:45:37 GMT
Vary: User-Agent
P3P: policyref="/w3c/p3p.xml", CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"
Connection: close
Content-Type: text/html; charset=UTF-8
Only work on Server
root@hq [~]# curl -I localhost
HTTP/1.1 200 OK
Date: Thu, 27 Apr 2017 05:47:28 GMT
Server: Apache
Accept-Ranges: bytes
X-Mod-Pagespeed: 1.11.33.4-0
Vary: Accept-Encoding
Cache-Control: max-age=0, no-cache
Content-Length: 111
Connection: close
Content-Type: text/html
User need put configuration for Virtualhost
A best regards
go to Home »Software »Rebuild RPM Database and click process after done in screen log you should see "D: adding "ea-apache24-mod_pagespeed" to Name index."
ReplyDeletefor your comment "User need put configuration for Virtualhost " configuration generate automatically after installation.
Hello,
ReplyDeletePagespeed is installed properly but I don't see the configuration file in /usr/local/apache/conf/.
There is no pagespeed.conf file there.
Try this
DeleteDir: /etc/apache2/conf.modules.d ,
File name :456_pagespeed.conf or x_pagespeed.conf
Google Page speed is very good for the website speed. It also improves performance of websites. You can confirm using http://gtmetrix.com
ReplyDeletehttps://www.24x7serversecurity.com
thank you so much my friend!
ReplyDeleteYou are welcome
DeleteI tried to install pagespeed for centos. But failed due to the following error.
ReplyDeleteRPM build errors:
File must begin with "/": %{_httpd_moddir}/*.so
File must begin with "/": %{_httpd_modconfdir}/*.conf
And its not installed successfully. But when i tried to open the web page it showing the below error.
This site can’t be reached
www.********.com took too long to respond.
Please help. Thanks in advance.