升级nginx版本

线上环境中一台服务器的nginx版本是1.4.2

查看当前版本,这是一些当前安装的一些模块和包,显然这些已经不能满足现在的需求了

[root@iZwz9ctckj6hl6tm4lgevyZ ~]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.4.2
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (GCC)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_ssl_module --add-module=../ngx_pagespeed-release-1.6.29.5-beta/

编译安装的环境和依赖的库

yum install gcc gcc-c++ pcre* zlib-devel openssl-devel gd-devel  php php-mysql php-fpm -y

上传nginx包

解压 tar zxf  nginx-1.13.9.tar.gz

进入目录

nginx-1.13.9

./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_image_filter_module --with-http_slice_module --with-mail --with-threads --with-file-aio --with-stream --with-mail_ssl_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-pcre --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module && make

进入原先的nginx的sbin目录里 备份一下nignx

cd /usr/local/nginx/sbin/

cp nginx nginx.old2

进入到刚编译的nginx1.13.9

cd /root/nginx-1.13.9/objs/

cp nginx /usr/local/nginx/sbin/

覆盖掉原来的nginx

摁 y

检查一下配置有没有问题

/usr/local/nginx/sbin/nginx -t

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

没有问题

查看一下当前版本

[root@iZwz9ctckj6hl6tm4lgevyZ conf]# /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.13.9
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-18) (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_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-http_image_filter_module --with-http_slice_module --with-mail --with-threads --with-file-aio --with-stream --with-mail_ssl_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-pcre --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module

启动nginx

/usr/local/nginx/sbin/nginx

查看是否起来

[root@iZwz9ctckj6hl6tm4lgevyZ conf]# ps aux | grep nginx
root 18215 0.0 0.0 73448 1384 ? Ss 10:24 0:00 nginx: master process /usr/local/nginx/sbin/nginx
www 18216 0.0 0.3 101100 29588 ? S 10:24 0:00 nginx: worker process
www 18217 0.0 0.3 101100 29324 ? S 10:24 0:00 nginx: worker process
www 18218 0.0 0.3 101100 29324 ? S 10:24 0:00 nginx: worker process
www 18219 0.0 0.3 101100 29308 ? S 10:24 0:00 nginx: worker process
root 18233 0.0 0.0 105368 888 pts/1 S+ 10:33 0:00 grep nginx

nginx版本升级成功

点一杯最爱的奶茶

posted @ 2018-03-02 10:36  青玉案元夕  阅读(156)  评论(0编辑  收藏  举报