Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

平滑升级nginx到最新版本

[复制链接]
老谁家的小谁 发表于 2011-9-5 12:33:47 | 显示全部楼层 |阅读模式
最近nginx出了漏洞http://sebug.net/vulndb/20898/
版本涉及较多 还是升级吧 正好帮助文档版块没有 就写一下

  1. cd /usr/local/src/
  2. wget http://nginx.org/download/nginx-1.0.5.tar.gz
  3. tar zxvf nginx-1.0.5.tar.gz
  4. cd nginx-1.0.5
复制代码

  1. /usr/local/nginx/sbin/nginx -V

  2. nginx: nginx version: nginx/0.6.39
  3. nginx: built by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
  4. nginx: configure arguments: --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/usr/local/nginx/logs/error.log --http-log-path=/usr/local/nginx/logs/access.log --pid-path=/usr/local/nginx/var/nginx.pid --lock-path=/usr/local/nginx/var/nginx.lock --without-select_module --without-poll_module --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --without-http_ssi_module --without-http_userid_module --without-http_geo_module --without-http_memcached_module --without-http_map_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-pcre=/usr/lib64
复制代码
这步是要得到编译参数,但是当前的参数有点问题,等下说,咱们继续

  1. ./configure --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/usr/local/nginx/logs/error.log --http-log-path=/usr/local/nginx/logs/access.log --pid-path=/usr/local/nginx/var/nginx.pid --lock-path=/usr/local/nginx/var/nginx.lock --without-select_module --without-poll_module --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --without-http_ssi_module --without-http_userid_module --without-http_geo_module --without-http_memcached_module --without-http_map_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-pcre=/usr/local/src/pcre-8.12
复制代码
用上面这段编译

make

千万不要手唆,这里不要make install

make完了 在objs目录下就多了个nginx,这个就是新版本的程序了

  1. mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx-0639
  2. cp objs/nginx /usr/local/nginx/sbin/nginx
  3. /usr/local/nginx/sbin/nginx -t
  4. 返回
  5. nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
  6. nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successfu

  7. 继续在/usr/local/src/nginx-1.0.5目录下执行

  8. make upgrade

复制代码
再次执行
  1. /usr/local/nginx/sbin/nginx -V
复制代码
返回

  1. nginx: nginx version: nginx/1.0.5
  2. nginx: built by gcc 4.1.2 20080704 (Red Hat 4.1.2-48)
  3. nginx: configure arguments: --prefix=/usr/local/nginx --sbin-path=/usr/local/nginx/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --error-log-path=/usr/local/nginx/logs/error.log --http-log-path=/usr/local/nginx/logs/access.log --pid-path=/usr/local/nginx/var/nginx.pid --lock-path=/usr/local/nginx/var/nginx.lock --without-select_module --without-poll_module --with-http_realip_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --without-http_ssi_module --without-http_userid_module --without-http_geo_module --without-http_memcached_module --without-http_map_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-pcre=/usr/local/src/pcre-8.12
复制代码
OK  行了


下面是我遇到的错误,附处理办法

错误处理:
  1. make -f objs/Makefile
  2. make[1]: Entering directory `/usr/local/src/nginx-1.0.5′
  3. cd /usr/local/pcre /
  4.         && if [ -f Makefile ]; then make distclean; fi /
  5.         && CC="gcc" CFLAGS="-O2 -fomit-frame-pointer -pipe " /
  6.         ./configure –disable-shared
  7. /bin/sh: line 2: ./configure: No such file or directory
  8. make[1]: *** [/usr/local/pcre/Makefile] Error 127
  9. make[1]: Leaving directory `/usr/local/src/nginx-1.0.5′
  10. make: *** [build] Error 2
复制代码
pcre路径不对啊

解决办法:
  1. wget http://downloads.sourceforge.net/project/pcre/pcre/8.12/pcre-8.12.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fpcre%2Ffiles%2Fpcre%2F8.12%2F&ts=1314322937&use_mirror=cdnetworks-kr-2

  2. tar zxvf pcre-8.12.tar.gz
  3. 把以前的
  4. --with-pcre=/usr/lib64
  5. 换成
  6. --with-pcre=/usr/local/src/pcre-8.12
复制代码
再编译即可解决

评分

1

查看全部评分

King_Sun 发表于 2011-9-5 14:25:18 | 显示全部楼层
本帖最后由 King_Sun 于 2011-9-5 14:28 编辑

楼主老大能帮俺升级一下吗,俺看了你的帖子,还是不会(是看不懂)
回复

使用道具 举报

IDC866.com 发表于 2011-9-5 14:33:32 | 显示全部楼层
希望  军哥  也即早换成  新安装包。  一键即OK
回复

使用道具 举报

pcyi 发表于 2011-9-5 14:58:07 | 显示全部楼层
这个教程出的刚刚好~
回复

使用道具 举报

onehua 发表于 2011-9-6 12:54:19 | 显示全部楼层
楼主没清理安装完后的垃圾文件。
回复

使用道具 举报

bwlx007 发表于 2011-10-7 03:19:05 | 显示全部楼层
appache用户路过,打算抽空置换为nginx,据说nginx比appache强10倍,在硬件配置相同的情况下
回复

使用道具 举报

xiaoyuwxz 发表于 2011-10-7 08:49:16 | 显示全部楼层
我的方法是停nginx,对原nginx改名,然后再安装新的nginx,拷回原nginx配置文件,启动服务
回复

使用道具 举报

maojieming 发表于 2011-10-7 12:41:18 | 显示全部楼层
刚学习nginx
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-6-16 22:31 , Processed in 0.096626 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表