升级Nginx到1.6.2(With SPDY)

ZephyrXT 发布于 阅读:67 奇技

官网:http://nginx.org/

wget http://nginx.org/download/nginx-1.6.2.tar.gz

tar xzf nginx-1.*.*.tar.gz

cd nginx-1.*.*

wget https://www.openssl.org/source/openssl-1.0.2.tar.gz

wget https://github.com/PeterMosmans/openssl/archive/1.0.2-chacha.zip

tar xzvf openssl-1.*.*.tar.gz

 ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ipv6 --with-http_mp4_module --with-http_spdy_module --with-openssl=./openssl-1.0.2

make

/root/lnmp stop

cp -r objs/nginx /usr/local/nginx/sbin/nginx

cd ..

rm -rf nginx-1.*.*.tar.gz nginx-1.*.*

/root/lnmp start


——————修改配置文件并重启生效——————

http://nginx.org/en/docs/http/ngx_http_spdy_module.html

Example Configuration

server {

    listen 443 ssl spdy;

    ssl_certificate server.crt;

    ssl_certificate_key server.key;

    ...

}

/root/lnmp start

 

——————可能的故障——————

Nginx升级到1.1.1*版本后,会出现nginx: [warn] the "log_format" directive may be used only on "http" level in /usr/local/nginx/conf/nginx.conf:84的警告。

将/usr/local/nginx/conf/nginx.conf 里server段里的下面代码移出放到该server段的前面即可。

log_format  access  '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" $http_x_forwarded_for';

如果有其的虚拟主机开启了日志,也按上面的要求移出server段放在server段的前面即可。

再/usr/local/nginx/sbin/nginx -t 测试一下,没有warn警告信息了。

——————或者平滑升级——————

 mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
 cp -r objs/nginx /usr/local/nginx/sbin/nginx
 nginx -t

 kill -USR2 `cat /usr/local/nginx/logs/nginx.pid`
 sleep 15
 kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin`
 ls

LNMP Nginx 一键升级到8.54最新稳定版

https://bbs.zephyrxt.com/thread-3403-1-1.html

——————SPDY效果——————

Chrome (need to be turned on at chrome://flags) and Firefox (turned on by default ater version 13) support SPDY protocol at present.

To check the SPDY status, see page: chrome://net-internals/#spdy (for Chrome) or install SPDY indicator (for Firefox)

 

参考:

SPDY 是什么?如何部署 SPDY?

https://bbs.zephyrxt.com/thread-13296-1-1.html

收到1条评论
avatar
ZephyrXT 2014-11-16 09:34
wget http://softlayer-dal.dl.sourceforge.net/project/pcre/pcre/8.36/pcre-8.36.tar.gz
tar zxvf pcre-8.*.tar.gz
cd pcre-8.*/
./configure
make && make install
cd ../
ldconfig

groupadd www
useradd -s /sbin/nologin -g www www

mkdir -p /home/wwwroot
chmod +w /home/wwwroot
mkdir -p /home/wwwlogs
chmod 777 /home/wwwlogs

chown -R www:www /home/wwwroot

echo "/usr/local/nginx/sbin/nginx" >> /etc/rc.local