Download the pagespeed RPM package from the official website
wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm

Create a temporary directory to extract the so file in the rpm package and copy it to the apache modules directory

mkdir mod_pagespeed
rpm2cpio ../mod-pagespeed-stable_current_x86_64.rpm | cpio -idmv
cp usr/lib64/httpd/modules/mod_pagespeed_ap24.so /www/server/apache/modules/mod_pagespeed_ap24.so

Add a pagespeed configuration file and call it in apache

mkdir -p /var/cache/mod_pagespeed/
chown -R www.www /var/cache/mod_pagespeed/
echo 'Include conf/pagespeed.conf' >> /www/server/apache/conf/httpd.conf

LoadModule pagespeed_module /usr/local/apache/modules/mod_pagespeed_ap24.so
<IfModule pagespeed_module>
    ModPagespeed on
    AddOutputFilterByType MOD_PAGESPEED_OUTPUT_FILTER text/html
    ModPagespeedFileCachePath            "/var/cache/mod_pagespeed/"
    ModPagespeedFileCacheInodeLimit        500000
    ModPagespeedAvoidRenamingIntrospectiveJavascript on
    ModPagespeedEnableFilters collapse_whitespace
    <Location /mod_pagespeed_beacon>
          SetHandler mod_pagespeed_beacon
    </Location>
    <Location /mod_pagespeed_statistics>
        Order allow,deny
        Allow from localhost
        Allow from 127.0.0.1
        SetHandler mod_pagespeed_statistics
    </Location>
    ModPagespeedMessageBufferSize 100000
 
    <Location /mod_pagespeed_message>
        Allow from localhost
        Allow from 127.0.0.1
        SetHandler mod_pagespeed_message
    </Location>
</IfModule>

Check if the module has been loaded after restarting apache

/etc/init.d/httpd restart
/www/server/apache/bin/apachectl -M

    5 months later

    hi,
    Thanks!
    This work global or same cpael? need add in site htaccess file ModPagespeed on?
    Thx!

    19 days later
    a year later
    2 months later