1.部署環(huán)境Centos7.3+nginx1.10.1+php5.6.30(FPM)
原先有部署了nginx+php
需把pagespeed 插件編譯進nginx
a.下載pagespeed
wget https://github.com/pagespeed/ngx_pagespeed/archive/v${NPS_VERSION}-beta.zip
(NPS_VERSION)是你要採用的版本木蹬,如果不知道版本號斩郎,可用到這來查看
https://modpagespeed.com/doc/release_notes
我下載的是最新版本
wget https://github.com/pagespeed/ngx_pagespeed/archive/v1.12.34.2-beta.zip
解壓
unzip v1.12.34.2-beta.zip &&cd ngx_pagespeed-1.12.34.2-beta
wget https://dl.google.com/dl/page-speed/psol/1.12.34.2-x64.tar.gz
tar zxvf 1.12.34.2-x64.tar.gz
cd /root/nginx-1.10.1
./configue --prefix=/data0/nginx ?{xxxxxx} --add-module=/data0/soft/ngx_pagespeed-1.12.34.2-beta/
{xxxxxx} 為你之前編譯的參數(shù)悉稠,用nginx -V 可用查看
make && make install
2.配置nginx.conf 開啟支持合併壓縮
Build instructions
First download ngx_pagespeed:
NPS_VERSION=[check therelease notesfor the latest version]cdwget https://github.com/pagespeed/ngx_pagespeed/archive/v${NPS_VERSION}-beta.zip
unzip v${NPS_VERSION}-beta.zipcd ngx_pagespeed-${NPS_VERSION}-beta/psol_url=https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz[ -e scripts/format_binary_url.sh ] && psol_url=$(scripts/format_binary_url.sh PSOL_BINARY_URL)wget ${psol_url}tar -xzvf $(basename ${psol_url})? # extracts to psol/
Download and build nginx with support for pagespeed:
NGINX_VERSION=[checknginx's sitefor the latest version]cdwget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gztar -xvzf nginx-${NGINX_VERSION}.tar.gzcd nginx-${NGINX_VERSION}/./configure --add-module=$HOME/ngx_pagespeed-${NPS_VERSION}-beta ${PS_NGX_EXTRA_FLAGS}makesudo make install
參考以下:
https://modpagespeed.com/doc/release_notes
https://modpagespeed.com/doc/build_ngx_pagespeed_from_source
https://linux.cn/article-4227-1.html
https://modpagespeed.com/doc/configuration
https://shazi.info/nginx-%E5%B0%88%E6%B3%A8%E6%96%BC-cdn-%E7%9A%84-pagespeed-module/