Chinaunix首页 | 论坛 | 博客
  • 博客访问: 9250535
  • 博文数量: 1669
  • 博客积分: 16831
  • 博客等级: 上将
  • 技术积分: 12594
  • 用 户 组: 普通用户
  • 注册时间: 2011-02-25 07:23
个人简介

柔中带刚,刚中带柔,淫荡中富含柔和,刚猛中荡漾风骚,无坚不摧,无孔不入!

文章分类

全部博文(1669)

文章存档

2023年(4)

2022年(1)

2021年(10)

2020年(24)

2019年(4)

2018年(19)

2017年(66)

2016年(60)

2015年(49)

2014年(201)

2013年(221)

2012年(638)

2011年(372)

分类: 系统运维

2013-11-27 16:34:18

D11-Nginx-Upgrade
2012-10-08 09:32:25
标签:linux module nginx upgrade
原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://dngood.blog.51cto.com/446195/1017670
D11-Nginx-Upgrade
 
有两种情况下需要升级Nginx:
1 要升级到Nginx 的新版本
2 要为Nginx 添加新的模块
 
 
1 查看Nginx版本 与 配置参数
/usr/local/nginx/sbin/nginx -V 
nginx version: nginx/0.8.52
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-46)
TLS SNI support disabled
configure arguments: --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fcgi
 
2 关闭Nginx
/usr/local/nginx/sbin/nginx -s stop 


3 升级新版本Nginx
tar zxf nginx-1.2.3.tar.gz 
cd nginx-1.2.3 
./configure --prefix=/usr/local/nginx --with-pcre=../pcre-8.12/ --with-openssl=/usr/local/openssl/ --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --user=www --group=www 
make 
注意:没有make install


4 备份
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old 
cp /root/nginx-1.2.3/objs/nginx /usr/local/nginx/sbin/ 
cp: overwrite `/usr/local/nginx/sbin/nginx'? y 
注意:旧版本(sbin/nginx)仍可使用


5 测试
/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
/usr/local/nginx/sbin/nginx -V 
nginx version: nginx/1.2.3
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-46)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --with-pcre=../pcre-8.12/ --with-openssl=/usr/local/openssl/ --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --user=www --group=www


6 比较
du -sh * 
6.2M    nginx
4.3M    nginx.old


7 启动nginx
/usr/local/nginx/sbin/nginx  




参考
平滑升级你的Nginx 


PS: 这里未能实现nginx 在线升级。
#update 20121221  stub_status模块
Nginx中的stub_status模块主要用于查看Nginx的一些状态信息, 如果你要使用stub_status模块模块,则要在编译安装Nginx时指定,或者添加.
查看Nginx版本 与 配置参数 
nginx -V 
nginx version: nginx/1.2.3 
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-46) 
TLS SNI support enabled 
configure arguments: --prefix=/usr/local/nginx --with-pcre=../pcre-8.12/ --with-openssl=/usr/local/openssl/ --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --user=www --group=www 
 
配置并编译 
tar zxf nginx-1.2.3.tar.gz 
tar zxf pcre-8.12.tar.gz 
./configure --prefix=/usr/local/nginx --with-pcre=../pcre-8.12/ --with-openssl=/usr/local/openssl/ --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --user=www --group=www --with-http_stub_status_module  
make 
注意:没有make install 
 
备份 
nginx -s stop 
cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old.2 
cp /root/nginx-1.2.3/objs/nginx /usr/local/nginx/sbin/  
cp: overwrite `/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 
/usr/local/nginx/sbin/nginx -V 
nginx version: nginx/1.2.3 
built by gcc 4.1.2 20080704 (Red Hat 4.1.2-46) 
TLS SNI support enabled 
configure arguments: --prefix=/usr/local/nginx --with-pcre=../pcre-8.12/ --with-openssl=/usr/local/openssl/ --with-http_ssl_module --with-http_flv_module --with-http_gzip_static_module --user=www --group=www --with-http_stub_status_module 
 
配置 
vim /usr/local/nginx/conf/vhosts/
        location /nginx-status { 
             auth_basic              "NginxStatus"; 
             allow 192.168.4.35; 
             deny all; 
             stub_status on; 
             access_log  on; 
        } 
 
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 
nginx  


结束
更多请:
linux 相关 37275208
vmware 虚拟化相关  166682360
本文出自 “dongnan” 博客,请务必保留此出处http://dngood.blog.51cto.com/446195/1017670
阅读(1319) | 评论(0) | 转发(0) |
0

上一篇:D7-Nginx-SSL

下一篇:抓包工具 tcpdump

给主人留下些什么吧!~~