InBlock.gif按照张宴的文档完成了nginx0.8+php5.2.13(fastcgi)+mysql5.5.3的安装,准备将nginx平滑升级。
InBlock.gif
InBlock.gif1、备份nginx的可执行程序:
InBlock.gif [root@svr2 sbin]# cp nginx /root/nginx_old
InBlock.gif [root@svr2 sbin]# pwd
InBlock.gif /usr/local/webserver/nginx/sbin
InBlock.gif
InBlock.gif#执行升级信号
InBlock.gif [root@svr2 sbin]# kill -USR2 `cat /usr/local/webserver/nginx/nginx.pid `
InBlock.gif
InBlock.gif#系统会将nginx.pid进行重命名nginx.pid.oldbin
InBlock.gif [root@svr2 sbin]# ll /usr/local/webserver/nginx/
InBlock.gif total 88
InBlock.gif drwx------ 2 www root 4096 Aug 18 02:48 client_body_temp
InBlock.gif drwxr-xr-x 2 root root 4096 Aug 18 02:57 conf
InBlock.gif drwx------ 2 www root 4096 Aug 17 05:40 fastcgi_temp
InBlock.gif drwxr-xr-x 2 root root 4096 Aug 17 05:36 html
InBlock.gif drwxr-xr-x 2 root root 4096 Aug 18 02:56 logs
InBlock.gif -rw-r--r-- 1 root root 5 Aug 18 05:33 nginx.pid
InBlock.gif -rw-r--r-- 1 root root 5 Aug 17 06:38 nginx.pid.oldbin
InBlock.gif drwx------ 2 www root 4096 Aug 17 05:40 proxy_temp
InBlock.gif drwxr-xr-x 2 root root 4096 Aug 17 05:36 sbin
InBlock.gif drwx------ 2 www root 4096 Aug 17 05:40 scgi_temp
InBlock.gif drwx------ 2 www root 4096 Aug 17 05:40 uwsgi_temp
InBlock.gif
InBlock.gif#开始编译
InBlock.gif [root@svr2 ~]# tar -xzf nginx-1.0.5.tar.gz
InBlock.gif [root@svr2 ~]# cd nginx-1.0.5
InBlock.gif [root@svr2 nginx-1.0.5]# ./configure --prefix=/usr/local/webserver/nginx/ \
InBlock.gif > --with-http_ssl_module --with-http_stub_status_module --user=www --group=www
InBlock.gif [root@svr2 nginx-1.0.5]# make && make install    
InBlock.gif
InBlock.gif#
InBlock.gif [root@svr2 ~]# ps -eo pid,ppid,user,vsz,wchan,command --forest | grep nginx
InBlock.gif
InBlock.gif 4125 1 root 5884 rt_sig nginx: master process /usr/local/webserver/nginx/sbin/nginx (老)
InBlock.gif 6532 4125 www 18428 322807 \_ nginx: worker process
InBlock.gif 6533 4125 www 18836 322807 \_ nginx: worker process
InBlock.gif 6534 4125 www 18428 322807 \_ nginx: worker process
InBlock.gif 6535 4125 www 18428 322807 \_ nginx: worker process
InBlock.gif 6536 4125 www 18428 322807 \_ nginx: worker process
InBlock.gif 6537 4125 www 18836 322807 \_ nginx: worker process
InBlock.gif 6538 4125 www 18772 - \_ nginx: worker process
InBlock.gif 6539 4125 www 18772 322807 \_ nginx: worker process
InBlock.gif 7644 4125 root 5756 rt_sig \_ nginx: master process /usr/local/webserver/nginx/sbin/nginx (新)
InBlock.gif 7645 7644 www 18336 322807 \_ nginx: worker process
InBlock.gif 7646 7644 www 18300 322807 \_ nginx: worker process
InBlock.gif 7647 7644 www 18300 322807 \_ nginx: worker process
InBlock.gif 7648 7644 www 18300 322807 \_ nginx: worker process
InBlock.gif 7649 7644 www 18300 322807 \_ nginx: worker process
InBlock.gif 7650 7644 www 18300 322807 \_ nginx: worker process
InBlock.gif 7651 7644 www 18300 322807 \_ nginx: worker process
InBlock.gif 7652 7644 www 18300 322807 \_ nginx: worker process    
InBlock.gif
InBlock.gif[root@svr2 ~]# cat /usr/local/webserver/nginx/nginx.pid.oldbin
InBlock.gif 4125
InBlock.gif [root@svr2 ~]# cat /usr/local/webserver/nginx/nginx.pid
InBlock.gif 7644
InBlock.gif
InBlock.gif#原nginx已经停掉了,现在是新的进程在跑
InBlock.gif [root@svr2 nginx-1.0.5]# kill -WINCH 4125
InBlock.gif [root@svr2 ~]# ps -eo pid,ppid,user,vsz,wchan,command --forest | grep nginx
InBlock.gif 9854 7677 root 3920 pipe_w \_ grep nginx
InBlock.gif 4125 1 root 5884 rt_sig nginx: master process /usr/local/webserver/nginx/sbin/nginx
InBlock.gif 7644 4125 root 5756 rt_sig \_ nginx: master process /usr/local/webserver/nginx/sbin/nginx
InBlock.gif 7645 7644 www 18336 322807 \_ nginx: worker process
InBlock.gif 7646 7644 www 18300 322807 \_ nginx: worker process
InBlock.gif 7647 7644 www 18300 322807 \_ nginx: worker process
InBlock.gif 7648 7644 www 18300 322807 \_ nginx: worker process
InBlock.gif 7649 7644 www 18300 322807 \_ nginx: worker process
InBlock.gif 7650 7644 www 18300 322807 \_ nginx: worker process
InBlock.gif 7651 7644 www 18300 322807 \_ nginx: worker process
InBlock.gif 7652 7644 www 18300 322807 \_ nginx: worker process    
InBlock.gif
InBlock.gif#我重启了一下,这步应该是不用的。
InBlock.gif [root@svr2 nginx-1.0.5]# kill -QUIT 4125
InBlock.gif
InBlock.gif#现在只有7644这个进程在跑
InBlock.gif [root@svr2 ~]# ps -eo pid,ppid,user,%cpu,vsz,wchan,command | grep nginx
InBlock.gif 7644 1 root 0.0 5888 rt_sig nginx: master process /usr/local/webserver/nginx/sbin/nginx
InBlock.gif 9883 7644 www 0.0 18760 322807 nginx: worker process
InBlock.gif 9884 7644 www 0.0 18432 322807 nginx: worker process
InBlock.gif 9885 7644 www 0.0 18432 322807 nginx: worker process
InBlock.gif 9886 7644 www 0.0 18432 322807 nginx: worker process
InBlock.gif 9887 7644 www 0.0 18432 322807 nginx: worker process
InBlock.gif 9888 7644 www 0.0 18432 322807 nginx: worker process
InBlock.gif 9889 7644 www 0.0 18432 322807 nginx: worker process
InBlock.gif 9890 7644 www 0.0 18432 322807 nginx: worker process
InBlock.gif 9903 7677 root 0.0 3924 pipe_w grep nginx
InBlock.gif
InBlock.gif看下nginx的可执行文件:
InBlock.gif [root@svr2 ~]# ll /usr/local/webserver/nginx/sbin/
InBlock.gif total 7428
InBlock.gif -rwxr-xr-x 1 root root 3818413 Aug 18 05:39 nginx
InBlock.gif -rwxr-xr-x 1 root root 3765437 Aug 17 05:36 nginx.old
InBlock.gif
InBlock.gif#系统版本1.0.5
InBlock.gif [root@svr2 ~]# /usr/local/webserver/nginx/sbin/nginx -v
InBlock.gif nginx: nginx version: nginx/1.0.5