安装相关依赖包
PCRE库(用于支持http rewrite)
cd /usr/local/src wget http://exim.mirror.fr/pcre/pcre-8.37.tar.gz #其它版本 http://exim.mirror.fr/pcre/ tar zxvf pcre-8.37.tar.gz cd pcre-8.37 ./configure make && make install
zlib库(用于支持http gzip)
cd /usr/local/src wget http://zlib.net/zlib-1.2.8.tar.gz tar zxvf zlib-1.2.8.tar.gz cd zlib-1.2.8 ./configure make && make install
下载nginx源码包(v1.8.0)
wget http://nginx.org/download/nginx-1.8.0.tar.gz
解压、编译、安装(采用默认安装配置,但pcre的位置需要指定)
cd /usr/local/src tar zxvf nginx-1.8.0.tar.gz cd nginx-1.8.0 #之前配置保留,要支持 https ssl 附加(首先确保已安装 openssl openssl-devel) --with-http_ssl_module ./configure --prefix=/usr/local/nginx --user=nginx --group=www --with-pcre --with-pcre=/usr/local/src/pcre-8.37 --with-http_ssl_module make 特别注意:不要!!!! make install
查看
./objs/nginx -V nginx version: nginx/1.8.0 built by gcc 4.1.2 20080704 (Red Hat 4.1.2-55) built with OpenSSL 1.0.0d 8 Feb 2011 TLS SNI support enabled
备份旧版本
mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old
转移
mv ./objs/nginx /usr/local/nginx/sbin/nginx
测试
/usr/local/nginx/sbin/nginx -t
更新
make upgrade
最后
nginx -V nginx version: nginx/1.8.0 built by gcc 4.1.2 20080704 (Red Hat 4.1.2-55) built with OpenSSL 1.0.0d 8 Feb 2011...
至此Nginx平滑升级成功。
共 0 条评论