Apache 安裝配置mod_pagespeed加速模塊
mod_pagespeed目前支持Apache和Nginx。Apache中簡(jiǎn)單的安裝方法如下。安裝完成之后,它會(huì)在yum里新建一個(gè)安裝源,之后通過(guò)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系統(tǒng)設(shè)置開(kāi)機(jī)自動(dòng)運(yùn)行腳本的方法實(shí)例
這篇文章主要給大家介紹了關(guān)于Linux系統(tǒng)設(shè)置開(kāi)機(jī)自動(dòng)運(yùn)行腳本的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用Linux系統(tǒng)具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-06-06
虛擬機(jī)中Linux新手入門(mén)配置IP以及重啟網(wǎng)絡(luò)
這篇文章主要為大家詳細(xì)介紹了虛擬機(jī)中Linux新手入門(mén)配置IP以及重啟網(wǎng)絡(luò)的方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-03-03
淺談Linux下免密碼切換到root用戶(hù)當(dāng)注意的問(wèn)題
下面小編就為大家?guī)?lái)一篇淺談Linux下免密碼切換到root用戶(hù)當(dāng)注意的問(wèn)題。小編覺(jué)得挺不錯(cuò)的?,F(xiàn)在就分享給大家。也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-12-12
啟用 Apache Rewrite 重寫(xiě)模塊的詳細(xì)過(guò)程
Apache的mod_rewrite是最強(qiáng)大的URL 操作模塊之一,使用 mod_rewrite,您可以重定向和重寫(xiě) url,這對(duì)于在您的網(wǎng)站上實(shí)現(xiàn) seo 友好的 URL 結(jié)構(gòu)特別有用,在本文中,我們將引導(dǎo)您了解如何在基于 Debian 和基于 RHEL 的系統(tǒng)上在 Apache 中啟用 mod 重寫(xiě),感興趣的朋友一起看看吧2025-02-02
Linux下實(shí)現(xiàn)定時(shí)器Timer的幾種方法總結(jié)
下面小編就為大家?guī)?lái)一篇Linux下實(shí)現(xiàn)定時(shí)器Timer的幾種方法總結(jié)。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-10-10
Ubuntu 17.04系統(tǒng)下源碼編譯安裝opencv的步驟詳解
這篇文章主要給大家介紹了在Ubuntu 17.04系統(tǒng)下源碼編譯安裝opencv的相關(guān)資料,文中將一步步的步驟介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面跟著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。2017-08-08

