Installing mod_pagespeed on cPanel EA4

Follow these steps to install mod_pagespeed on a cPanel/WHM server running CentOS 7.

  1. Open the RPM macro file:

    nano /etc/rpm/macros.apache2
    
  2. Add these lines to the file and save it:

    %_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
    
  3. Continue the installation with these commands:

    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
    
  4. Finally, select the mod_pagespeed module in EasyApache 4 and rebuild the web server.

For caching and compression settings, see .htaccess caching and compression settings.

Was this article helpful?