记录日常工作关于系统运维,虚拟化云计算,数据库,网络安全等各方面问题。
 
0

nginx 版本升级

发表者:admin分类:应用服务2019-09-23 22:38:49 阅读[235]

nginx 版本升级


1.使用/usr/local/nginx/sbin/nginx -V查看当前版本和配置

[root@KW-GED-YX-M servertest]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.5.7
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) 
TLS SNI support enabled

configure arguments: --error-log-path=/usr/local/nginx/logs/error.log --http-log-path=/usr/local/nginx/logs/access.log --pid-path=/usr/local/nginx/logs/nginx.pid --lock-path=/usr/local/nginx/logs/nginx.lock --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_ssl_module --with-pcre=../pcre-8.33 --add-module=../nginx-upload-module-2.2 --add-module=../nginx_tcp_proxy_module-master --with-http_auth_request_module


Lumanager自己的路查看nginx 版本信息如下:

[root@iZ28seu98swZ cmd]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.0.15
built by gcc 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) 
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-pcre=../pcre-8.10 --with-openssl=../openssl-1.0.1c --add-module=../ngx_cache_purge-1.3 --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module


编译软件时,需要将对应的openssl, pcre 源码包解压到参数对应的目录里面,才可以安装软件。


2.下载要添加的模块

下载pcre

wget http://ftp.exim.llorien.org/pcre/pcre-8.33.tar.gz

tar -xvf pcre-8.33.tar.gz

 

下载nginx upload插件

wget https://github.com/Austinb/nginx-upload-module/archive/2.2.zip

unzip 2.2

解压出nginx-upload-module-2.2

该地址下载的模块支持nginx1.11以后版本。

3.升级nginx

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

tar -xvf nginx-1.12.0.tar.gz

cd nginx-1.12.0


3.1安装检测

./configure  \

--error-log-path=/usr/local/nginx/logs/error.log \

--http-log-path=/usr/local/nginx/logs/access.log \

--pid-path=/usr/local/nginx/logs/nginx.pid \

--lock-path=/usr/local/nginx/logs/nginx.lock \

--sbin-path=/usr/local/nginx/sbin/nginx \

--conf-path=/usr/local/nginx/conf/nginx.conf \

--with-http_ssl_module \

--with-pcre=../pcre-8.33 \

--add-module=../nginx-upload-module-2.2 \

--with-http_auth_request_module \

--with-http_stub_status_module \

--with-http_ssl_module \

--with-file-aio \

--with-threads


3.2 make

 
3.3备份sbin目录下的nginx文件

cd /usr/local/nginx/sbin/

cp nginx nginx.old


3.4复制新的nginx文件

cd /path-to-nginx/nginx-1.12.0

cp objs/nginx /usr/local/nginx/sbin/


3.5 make upgrade
3.6 检查升级是否成功

[root@KW-GED-YXUP-test logs]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.12.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) 
built with OpenSSL 1.0.0-fips 29 Mar 2010
TLS SNI support enabled
configure arguments: --error-log-path=/usr/local/nginx/logs/error.log --http-log-path=/usr/local/nginx/logs/access.log --pid-path=/usr/local/nginx/logs/nginx.pid --lock-path=/usr/local/nginx/logs/nginx.lock --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_ssl_module --with-pcre=../pcre-8.33 --add-module=../nginx-upload-module-2.2 --with-http_auth_request_module --with-http_stub_status_module --with-http_ssl_module --with-file-aio --with-threads



转载请标明出处【nginx 版本升级】。

《www.92cto.com》 虚拟化云计算,系统运维,安全技术服务.

网站已经关闭评论