#查看当前版本及原配置,注意记录下此配置
[dongzw@localhost ~]$ /data/fdfs/nginx/sbin/nginx -V
nginx version: nginx/1.4.7
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)
configure arguments: --prefix=/data/fdfs/nginx --add-module=/data/fdfs/soft/fastdfs-nginx-module/src --with-pcre=/data/fdfs/soft/pcre-8.35 --with-zlib=/data/fdfs/soft/zlib-1.2.8 --with-openssl=/data/fdfs/soft/openssl-1.0.1c
# 备份
[dongzw@localhost fdfs]$ mv nginx nginx_1.4.7_bak
# 下载:http://nginx.org/download/ 解压新版
[dongzw@localhost fdfs]$ tar -zxf nginx-1.18.0.tar.gz
[dongzw@localhost fdfs]$ ls
fastdfs nginx-1.18.0 nginx-1.18.0.tar.gz nginx_1.4.7_bak soft
# 进入解压目录
[dongzw@localhost fdfs]$ cd nginx-1.18.0
# 根据原版本信息配置安装信息
[dongzw@localhost nginx-1.18.0]$ ./configure --prefix=/data/fdfs/nginx --add-module=/data/fdfs/soft/fastdfs-nginx-module/src --with-pcre=/data/fdfs/soft/pcre-8.35 --with-zlib=/data/fdfs/soft/zlib-1.2.8 --with-openssl=/data/fdfs/soft/openssl-1.0.1c
checking for OS
+ Linux 3.10.0-862.el7.x86_64 x86_64
...........
[dongzw@localhost nginx-1.18.0]$ echo $?
0
# 编译
[dongzw@localhost nginx-1.18.0]$ make
............
sed -e "s|%%PREFIX%%|/data/fdfs/nginx|" \
-e "s|%%PID_PATH%%|/data/fdfs/nginx/logs/nginx.pid|" \
-e "s|%%CONF_PATH%%|/data/fdfs/nginx/conf/nginx.conf|" \
-e "s|%%ERROR_LOG_PATH%%|/data/fdfs/nginx/logs/error.log|" \
< man/nginx.8 > objs/nginx.8
make[1]: Leaving directory `/data/fdfs/nginx-1.18.0'
[dongzw@localhost nginx-1.18.0]$ echo $?
0
# 安装
[dongzw@localhost nginx-1.18.0]$ make install
...........
[dongzw@localhost nginx-1.18.0]$ echo $?
0
# 查看新版本号
[dongzw@localhost nginx]$ sbin/nginx -V
nginx version: nginx/1.18.0
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)
configure arguments: --prefix=/data/fdfs/nginx --add-module=/data/fdfs/soft/fastdfs-nginx-module/src --with-pcre=/data/fdfs/soft/pcre-8.35 --with-zlib=/data/fdfs/soft/zlib-1.2.8 --with-openssl=/data/fdfs/soft/openssl-1.0.1c
# 备份新配置文件
[dongzw@localhost conf]$ cp nginx.conf nginx.conf_bak
# copy原配置文件到新目录
[dongzw@localhost conf]$ cp /data/fdfs/nginx_1.4.7_bak/conf/nginx.conf ./
# 启动
[dongzw@localhost nginx]$ sbin/nginx -c conf/nginx.conf
ngx_http_fastdfs_set pid=13130
# 停止
[dongzw@localhost nginx]$ sbin/nginx -s stop
ngx_http_fastdfs_set pid=13139
升级nginx记录
最新推荐文章于 2023-09-13 23:57:58 发布