Warning: Error while sending QUERY packet. PID=5475 in /home/wwwroot/coco/domain/cnlamp/web/wp-includes/wp-db.php on line 1924 Install mod_pagespeed Apache module on Apache 2.4/EA4 | LAMP新闻|技巧|经验|资讯站
现在的位置: 首页WEB服务器>正文
Install mod_pagespeed Apache module on Apache 2.4/EA4
发表于8月前 WEB服务器 暂无评论

Step1 : Download Pagespeed module manually and move it to Apache modules.

cd /usr/local/src
mkdir mod_pagespeed
cd 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
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/
cp /usr/local/src/mod_pagespeed/etc/httpd/conf.d/pagespeed.conf/usr/local/apache/conf/
cp /usr/local/src/mod_pagespeed/etc/httpd/conf.d/pagespeed_libraries.conf/usr/local/apache/conf/
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/

Step2: Move the pagespeed conf file from downloaded module files to Apache conf directory.

cp /usr/local/src/mod_pagespeed/etc/httpd/conf.d/pagespeed.conf/usr/local/apache/conf/
cp /usr/local/src/mod_pagespeed/etc/httpd/conf.d/pagespeed_libraries.conf/usr/local/apache/conf/

Step 3: Add the executable permissions for so files.

chmod 755 /usr/local/apache/modules/mod_pagespeed.so
chmod 755 /usr/local/apache/modules/mod_pagespeed_ap24.so
mkdir /var/mod_pagespeed/ -p
chown nobody:nobody /var/mod_pagespeed/*

Step 4 : Edit the mod_pagespeed configuration file to reflect the correct paths of the files:

# Attempt to load mod_version if it wasn’t loaded or compiled in (eg on Debian)
<IfModule !mod_version.c>
LoadModule version_module /usr/local/apache/modules/mod_version.so
</IfModule>

<IfVersion < 2.4>
LoadModule pagespeed_module /usr/local/apache/modules/mod_pagespeed.so
</IfVersion>

<IfVersion >= 2.4.2>
LoadModule pagespeed_module /usr/local/apache/modules/mod_pagespeed_ap24.so
</IfVersion>

# Only attempt to load mod_deflate if it hasn’t been loaded already.
<IfModule !mod_deflate.c>
LoadModule deflate_module /usr/local/apache/modules/mod_deflate.so
</IfModule>

Also modify this line:

ModPagespeedFileCachePath “/var/mod_pagespeed/”
Step5: Add this line to /usr/local/apache/conf/httpd.conf file:

Include “/usr/local/apache/conf/pagespeed.conf
To keep the changes permanent after a cPanel update:

/usr/local/cpanel/bin/apache_conf_distiller -–update

service httpd restart

Note: These Manual steps can also be apply on EasyApache4.

给我留言

留言无头像?


×
腾讯微博