在线升级nginx
2019-05-26 10:34
1386 查看
步骤一:构建Nginx服务器
1)使用源码包安装nginx软件包
[root@svr5 ~]# yum –y install gcc pcre-devel openssl-devel //安装常见依赖包 [root@svr5 ~]# useradd –s /sbin/nologin nginx [root@svr5 ~]# tar -zxvf nginx-1.7.10.tar.gz [root@svr5 ~]# cd nginx-1.7.10 [root@svr5 nginx-1.7.10]# ./configure \ > --prefix=/usr/local/nginx \ //指定安装路径 > --user=nginx \ //指定用户 > --group=nginx \ //指定组 > --with-http_stub_status_module \ //开启状态统计功能 > --with-http_ssl_module //开启SSL加密功能 .. .. nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp" [root@svr5 nginx-1.7.10]# make && make install //编译并安装
2)启用nginx服务
[root@svr5 ~]# /usr/local/nginx/sbin/nginx –c /usr/local/nginx/conf/nginx.conf nginx服务默认通过TCP 80端口监听客户端请求: [root@svr5 ~]# netstat -anptu | grep nginx tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 10441/nginx
3)为Nginx Web服务器建立测试首页文件
Nginx Web服务默认首页文档存储目录为/usr/local/nginx/html/,在此目录下建立一个名为index.html的文件:
[root@svr5 ~]# cat /usr/local/nginx/html/index.html <html> <head> <title>Welcome to nginx!</title> </head> <body bgcolor="white" text="black"> <center><h1>Welcome to nginx!</h1></center> </body> </html>
步骤二:升级Nginx服务器
1)编译新版本nginx软件
[root@svr5 ~]# tar -zxvf nginx-1.8.0.tar.gz [root@svr5 ~]# cd nginx-1.8.0 [root@svr5 nginx-1.8.0]# ./configure \ > --prefix=/usr/local/nginx \ > --user=nginx \ > --group=nginx \ > --with-http_stub_status_module \ > --with-http_ssl_module [root@svr5 nginx-1.8.0]# make
2)备份老的nginx主程序,并使用编译好的新版本nginx替换老版本
[root@svr5 nginx-1.8.0]# cd /usr/local/nginx/sbin/ [root@svr5 sbin]# mv nginx nginxold //备份旧版本 [root@svr5 sbin]# cd /root/ nginx-1.8.0/objs/ [root@svr5 objs]# cp nginx /usr/local/nginx/sbin/ //拷贝新版本 [root@svr5 objs]# cd /root/nginx-1.0.5 [root@svr5 nginx-1.8.0]# make upgrade //升级 /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 kill -USR2 `cat /usr/local/nginx/logs/nginx.pid` sleep 1 test -f /usr/local/nginx/logs/nginx.pid.oldbin kill -QUIT `cat /usr/local/nginx/logs/nginx.pid.oldbin` [root@svr5 ~]# /usr/local/nginx/sbin/nginx –v //查看版本
步骤三:客户端访问测试
1)分别使用浏览器和命令行工具curl测试服务器页面 [root@client ~]# firefox http://192.168.4.5 [root@client ~]# curl http://192.168.4.5
相关文章推荐
- Nginx在线服务状态下平滑升级或新增模块的详细操作记录
- nginx平滑升级、在线添加模块(tengine 动态加载模块)
- C/S模式在线升级之C#一种实现(一)
- 降魔变态版-在线升级全靠爆
- 在线升级Fedora 15 到Fedora 16
- LNMP一键安装包 自动无缝升级Nginx至任意版本
- 利用Android自带的DownloadManager实现文件下载进行apk在线升级
- 在freebsd6.2上在线升级到8.0
- nginx 不中断服务 平滑升级
- 小心点,不要瞎升级nginx
- nginx启动重启与升级以及检测配置文件
- Nginx平滑升级的详细操作方法
- Android OTA在线升级一(架构分析)
- nginx 平滑升级tengine
- nginx的平滑升级
- Linux在线升级yum(基于redhat)
- Nginx实用指南V1 (连载之三:启动与停止与平滑升级)
- 涛舅舅微信域名检测平台升级通知:支持在线批量检测模块
- nginx的--openssl版本升级
- C/S在线升级程序