免费资源网 – https://freexyz.cn/
目录实验环境:准备低版本Nginx服务器准备和编译新版本Nginx软件新版本替换旧版本
Nginx Web软件定期更新,以下为将低版本升级或将高版本降级的方法,一般分为四个部分:
软件下载——预编译——编译——配置
此次为低版本升级高版本实验:
具体如下:
实验环境:
[root@nginx ~]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core) [root@nginx ~]# uname -r 3.10.0-693.el7.x86_64准备低版本Nginx服务器
低版本环境安装请参考:
准备和编译新版本Nginx软件
查看旧版本Nginx:
[root@nginx nginx-1.10.3]# /app/nginx/sbin/nginx -V nginx version: nginx/1.8.1 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: –user=nginx –group=nginx –prefix=/app/nginx-1.8.1/ –with-http_stub_status_module –with-http_ssl_module下载新版本Nginx服务软件:
[root@nginx ~]# wget -q http://nginx.org/download/nginx-1.10.3.tar.gz解压后进入目录:
[root@nginx tools]# tar xf nginx-1.10.3.tar.gz [root@nginx tools]# cd nginx-1.10.3/进行预编译和编译:
[root@nginx nginx-1.10.3]# ./configure –user=nginx –group=nginx –prefix=/app/nginx-1.8.1/ –with-http_stub_status_module –with-http_ssl_module [root@nginx nginx-1.10.3]# make新版本替换旧版本
备份旧版本可执行文件:
[root@nginx ~]# mv /app/nginx/sbin/nginx /app/nginx/sbin/nginx.old [root@nginx nginx-1.10.3]# cp objs/nginx /app/nginx/sbin/检查新版本是否正常:
[root@nginx ~]# /app/nginx/sbin/nginx -t nginx: the configuration file /app/nginx-1.8.1//conf/nginx.conf syntax is ok nginx: configuration file /app/nginx-1.8.1//conf/nginx.conf test is successful进行平滑重启并查看版本:
[root@nginx ~]# /app/nginx/sbin/nginx -s reload [root@nginx ~]# /app/nginx/sbin/nginx -V nginx version: nginx/1.10.3 built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) built with OpenSSL 1.0.2k-fips 26 Jan 2017 TLS SNI support enabled configure arguments: –user=nginx –group=nginx –prefix=/app/nginx-1.8.1/ –with-http_stub_status_module –with-http_ssl_module检查进程:
[root@nginx ~]# ps -ef | grep nginx root 9003 1 0 10:24 ? 00:00:00 nginx: master process /app/nginx/sbin/nginx nginx 11720 9003 0 11:24 ? 00:00:00 nginx: worker process root 11724 1223 0 11:24 pts/0 00:00:00 grep –color=auto nginx检查端口:
[root@nginx ~]# ss -utpln | grep nginx tcp LISTEN 0 128 *:80 *:* users:((“nginx”,pid=11720,fd=6),(“nginx”,pid=9003,fd=6))到此Nginx版本升级工作完成!
以上就是Nginx服务安装及软件升级的详细内容,更多关于Nginx安装升级的资料请关注其它相关文章!
免费资源网 – https://freexyz.cn/
© 版权声明
THE END
暂无评论内容