Apache 安裝配置mod_pagespeed加速模塊
mod_pagespeed目前支持Apache和Nginx。Apache中簡單的安裝方法如下。安裝完成之后,它會(huì)在yum里新建一個(gè)安裝源,之后通過yum update更新就可以了
Centos/Fedora下安裝:
#32位 wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_i386.rpm #64位 wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm yum install at rpm -U mod-pagespeed-*.rpm
Debina/Ubuntu下安裝:
#32位 wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_i386.deb #64位 wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.deb dpkg -i mod-pagespeed-*.deb
重啟httpd:
service httpd restart
查看pagespeed是否加載:
httpd -M|grep pagespeed
配置mod_pagespeed
Tips:mod_pagespeed 需要 Apache 加載 mod_deflate(一個(gè)將 web內(nèi)容gzip壓縮后傳輸?shù)哪K)。
32位請(qǐng)執(zhí)行:wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_i386.rpm
64位請(qǐng)執(zhí)行:wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm
rpm2cpio ./mod-pagespeed-stable_current_i386.rpm | cpio -idmv
./etc/cron.daily/mod-pagespeed
./etc/httpd/conf.d/pagespeed.conf
./etc/httpd/conf.d/pagespeed_libraries.conf
./usr/bin/pagespeed_js_minify
./usr/lib/httpd/modules/mod_pagespeed.so
./usr/lib/httpd/modules/mod_pagespeed_ap24.so
./var/cache/mod_pagespeed
./var/log/pagespeed
27020 blocks
cp ./usr/lib/httpd/modules/mod_pagespeed.so /usr/local/apache/modules/ #apache版本>=2.4.2,用pagespeed_ap24.so
chmod 0755 /usr/local/apache/modules/mod_pagespeed.so
vim /usr/local/apache/conf/pagespeed.conf #新建配置文件,請(qǐng)根據(jù)自己需求修改
LoadModule pagespeed_module /usr/local/apache/modules/mod_pagespeed.so
<IfModule pagespeed_module>
ModPagespeed on
ModPagespeedInheritVHostConfig 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>
mkdir -p /var/mod_pagespeed/
chown -R www.www /var/mod_pagespeed/
echo 'Include conf/pagespeed.conf' >> /usr/local/apache/conf/httpd.conf
/usr/local/apache/bin/apachectl -t
Syntax OK
service httpd restart
相關(guān)文章
Linux下查詢外網(wǎng)IP的幾種方法總結(jié)
這篇文章主要介紹了Linux下查詢外網(wǎng)IP的幾種方法總結(jié)的相關(guān)資料,需要的朋友可以參考下2017-03-03
Linux常用查看硬件設(shè)備信息命令大全(值得收藏)
本文是小編收藏整理的關(guān)于linux查看硬件設(shè)備信息的命名,非常不錯(cuò),值得收藏,需要的朋友參考下吧2016-12-12
linux下終端分屏使用的兩種方法(screen和tmux)
這篇文章主要給大家介紹了關(guān)于在linux下終端分屏使用的兩種方法,分別是利用screen和tmux,文中介紹的非常詳細(xì),對(duì)大家具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來一起看看吧。2017-06-06
CentOS8 安裝 jdk8 / java8的教程(推薦)
CentOS8上使用 yum 直接安裝,環(huán)境變量自動(dòng)配置好 ,本文主要給大家介紹 CentOS8 安裝 jdk8 / java8的教程,非常不錯(cuò),具有一定的參考借鑒價(jià)值,需要的朋友參考下吧2019-10-10
基于Nginx0.8.54+PHP5.3.4+MySQL5.5.8的全新LNMP穩(wěn)定版架構(gòu)搭建的VPS
經(jīng)過幾個(gè)小時(shí)的編譯安裝配置,基于Nginx0.8.54+PHP5.3.4+MySQL5.5.8的全新LNMP穩(wěn)定版架構(gòu)搭建的VPS終于穩(wěn)定運(yùn)行。2010-12-12

