WDCP面板升级Nginx,并开启HTTP/2

Nginx在1.9.5时引入了HTTP/2支持,最近刚好有空,发现最新版已经是1.12.0了,就编译升级到了1.12.0。
http://nginx.org/en/docs/http/ngx_http_v2_module.html
根据文档说明添加编译参数
--with-http_v2_module即可,那么就这么写:
if [ ! $1 ];then ver="1.12.0" else ver=$1 fi cd /tmp wget http://down.wdlinux.cn/in/pcre_ins.sh sh pcre_ins.sh wget -c http://nginx.org/download/nginx-$ver.tar.gz [ $? != 0 ] && echo "down err" && exit tar zxvf nginx-$ver.tar.gz cd nginx-$ver ./configure --user=www --group=www --prefix=/www/wdlinux/nginx-$ver --with-http_stub_status_module --with-http_ssl_module --with-ipv6 --with-http_v2_module [ $? != 0 ] && echo "configure err" && exit make [ $? != 0 ] && echo "make err" && exit make install [ $? != 0 ] && echo "make install err" && exit mv /www/wdlinux/nginx-$ver/conf/nginx.conf /www/wdlinux/nginx-$ver/conf/nginx.conf.default cp -pR /www/wdlinux/nginx/conf/* /www/wdlinux/nginx-$ver/conf/ service nginxd stop rm -f /www/wdlinux/nginx ln -sf /www/wdlinux/nginx-$ver /www/wdlinux/nginx sed -i '/limit_zone/d' /www/wdlinux/nginx/conf/nginx.conf service nginxd start echo echo echo "nginx Update Is OK" echo "Current Ver Is:$ver" echo同时vhost文件监听的443端口,从:
listen 443;改为
listen 443 ssl http2;
即可开启HTTP/2(HTTP/2强制要求使用SSL,所以必须用了HTTPS才能使用HTTP/2)
使用较新版本的Chrome或者Firefox访问,可以看到版本已经显示为HTTP/2.0了——这个版本带来了一定的性能提升。



本文作者:起点终站
文章标题: WDCP面板升级Nginx,并开启HTTP/2
本文地址:https://blog.hellozwh.com/?post=275
版权声明:若无注明,本文皆为“起点终站”原创,转载请保留文章出处。
本文地址:https://blog.hellozwh.com/?post=275
版权声明:若无注明,本文皆为“起点终站”原创,转载请保留文章出处。

