LNMP 一键安装包平滑升级 Nginx 到最新版本

June 8th, 2010 | Categories: Linux | Tags: ,

nginx现在的最新开发版本是0.8.40 ,一些网友就是喜欢最新版本,都问我的LNMP一键安装包怎么升级 Nginx 到最新版本 ,现在,只要你简单的执行几句命令,就可以将 Nginx 升级到最新版本 ,只适合我的LNMP一键安装包,如果你知道你的LNMP安装启动的路径,也可以用这个方法的.

首先下最新版本,解压缩编译

wget http://nginx.org/download/nginx-0.8.40.tar.gz
tar zxvf nginx-0.8.40.tar.gz
cd nginx-0.8.40
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-ld-opt='-ltcmalloc_minimal'
make

一定不要make install !!!!!

接着备份原来的 nginx 文件

mv /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.old

然后复制编译好的 nginx 文件到/usr/local/nginx/sbin/nginx

cp objs/nginx /usr/local/nginx/sbin/nginx

检测nginx文件配置

/usr/local/nginx/sbin/nginx -t

直接重启Nginx

/etc/init.d/nginx restart

或者

kill -HUP `cat /usr/local/nginx/nginx.pid`

效果:http://vps.imcat.in/
BTW

如果需要更改header信息的话,可以修改nginx.h文件

vi src/core/nginx.h

找到

#define NGINX_VERSION      "0.7.62"
#define NGINX_VER          "nginx/" NGINX_VERSION

上面的版本号和nginx可以自己修改,例如:

#define NGINX_VERSION      "2010"
#define NGINX_VER          "Imcat/" NGINX_VERSION

BTW
关闭debug模式可以减少nginx文件的大小

vi auto/cc/gcc

找到这行,注释掉

#CFLAGS=”$CFLAGS -g”

Related posts:

  1. debian安装nginx+php(spawn-fcgi)+mysql
  2. 最新Linux下的Nginx+MySQL+PHP+Memcache+Vsftpd一键安装包
  3. CentOS安装crontab及使用方法
  4. 一步一步教你安装Nginx+PHP+Mysql
  5. nginx 下的 wordpress 3.0 rewrite规则
  1. June 8th, 2010 at 23:41

    不敢乱升级 怕弄坏... 等我换成diahosting再试 .

  2. June 9th, 2010 at 18:03

    非常不错

  3. July 12th, 2010 at 08:55

    嗯,我喜欢平滑升级,这就是 Linux 的优势,我讨厌繁杂的注册表方式。