Last active
December 29, 2015 09:15
-
-
Save yungke/632327fe744789251a49 to your computer and use it in GitHub Desktop.
nginx_ngx_pagespeed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/usr/local/nginx/sbin/nginx -V | |
nginx version: nginx/1.9.9 | |
built by gcc 4.8.2 20140120 (Red Hat 4.8.2-15) (GCC) | |
built with OpenSSL 1.0.1e-fips 11 Feb 2013 | |
TLS SNI support enabled | |
configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service nginx restart | |
curl -I 'https://gtour.info/' | grep X-Page-Speed | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 | |
X-Page-Speed: 1.10.33.2-7600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo yum install gcc-c++ pcre-devel zlib-devel make unzip | |
PS_NGX_EXTRA_FLAGS="--with-cc=/usr/lib/gcc-mozilla/bin/gcc --with-ld-opt=-static-libstdc++" | |
sudo rpm --import https://linux.web.cern.ch/linux/scientific6/docs/repository/cern/slc6X/i386/RPM-GPG-KEY-cern | |
sudo wget -O /etc/yum.repos.d/slc6-devtoolset.repo https://linux.web.cern.ch/linux/scientific6/docs/repository/cern/devtoolset/slc6-devtoolset.repo | |
sudo yum install devtoolset-2-gcc-c++ devtoolset-2-binutils | |
PS_NGX_EXTRA_FLAGS="--with-cc=/opt/rh/devtoolset-2/root/usr/bin/gcc" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx$(date +%m%d) # 備份 nginx 原文件 | |
cp objs/nginx /usr/local/nginx/sbin/nginx # 複製編譯 make 後的文件覆蓋 nginx 原文件 | |
/usr/local/nginx/sbin/nginx -t # 檢測 nginx 配置文件語法是否正確 | |
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok | |
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful | |
# kill -USR2 `cat /usr/local/nginx/logs/nginx.pid` # 把 nginx.pid 改成 nginx.pid.oldbin 跟著啟動新的 nginx | |
# kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin` # 退出舊的 nignx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NGINX_VERSION=1.9.9 | |
cd /root/oneinstack/src | |
tar -xvzf nginx-1.9.9.tar.gz | |
cd nginx-1.9.9/ | |
./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-ipv6 --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --add-module=$HOME/ngx_pagespeed-release-1.10.33.2-beta ${PS_NGX_EXTRA_FLAGS} | |
make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd | |
NPS_VERSION=1.10.33.2 | |
wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${NPS_VERSION}-beta.zip -O release-${NPS_VERSION}-beta.zip | |
unzip release-${NPS_VERSION}-beta.zip | |
cd ngx_pagespeed-release-${NPS_VERSION}-beta/ | |
wget https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz | |
tar -xzvf ${NPS_VERSION}.tar.gz # extracts to psol/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir /var/ngx_pagespeed_cache | |
chown www.www /var/ngx_pagespeed_cache | |
cp /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf$(date +%m%d) #備份nginx配置文件 | |
vi /usr/local/nginx/conf/nginx.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment