Nginx升级
2016-03-21 15:42
603 查看
转载,亲测可用,目前刚从1.4+升级到1.8+,之前的nginx使用apt-get安装的,不知道还有一种方法可不可行,就是直接apt-get update后upgrade,回去有机会也试试这种,下面的升级方法是收到下载编译并升级的.
转载自:http://www.cnblogs.com/terrysun/archive/2012/11/22/2782472.html 感谢博主,好文!
我的环境:
Ubuntu 12.04 LTS
Nginx 1.1.9
Nginx是通过apt-get的方式安装的,所以我的路径与下载代码再编译、安装的有些不一样,我的升级过程如下
1.进入Downloads文件夹
2.下载nginx-1.2.5.tar.gz文件到Downloads文件夹中
转载自:http://www.cnblogs.com/terrysun/archive/2012/11/22/2782472.html 感谢博主,好文!
我的环境:
Ubuntu 12.04 LTS
Nginx 1.1.9
Nginx是通过apt-get的方式安装的,所以我的路径与下载代码再编译、安装的有些不一样,我的升级过程如下
1.进入Downloads文件夹
cd /Downloads
2.下载nginx-1.2.5.tar.gz文件到Downloads文件夹中
wget http://nginx.org/download/nginx-1.2.5.tar.gz[/code]
3.解压nginx-1.2.5.tar.gz文件tar zxvf nginx-1.2.5.tar.gz
4.进入ngixn-1.2.5文件夹中cd nginx-1.2.5
5.查看nginx原来的配置nginx -V
上面的命令将输出:--prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module
6.执行configure命令,后面跟上原来nginx的配置./configure --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-debug --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_realip_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --with-mail --with-mail_ssl_module
在执行configure时得到几个错误:
a.配置 --with-http_xslt_module 时提示 the HTTP XSLT module requires the libxml2/libxslt librariessudo apt-get install libxml2 libxml2-dev libxslt-dev
b.配置 --with-http_image_filter_module 时提示 the HTTP image filter module requires the GD library.sudo apt-get install libgd2-xpm libgd2-xpm-dev
c.配置 --with-http_geoip_module 时提示 the GeoIP module requires the GeoIP library.sudo apt-get install geoip-database libgeoip-dev
d.rewrite需要pcre支持, 错误提示:./configure: error: the HTTP rewrite module requires the PCRE library.apt-get install libpcre3 libpcre3-dev
7.再执行第6步的configure命令
8.这次没有提示缺少library, 执行make令命编译nginx, 编译好以后objs目录下多出一个nginx文件,这个就是已编辑好的nginx程序make
9.更改旧的nginx程序的名子,并复制新的程序过去,我的旧nginx程序放在/usr/sbin/目录中mv /usr/sbin/nginx /usr/sbin/nginx-20121122cp objs/nginx /usr/sbin/nginx/usr/sbin/nginx -t
执行/usr/sbin/nginx -t 命令检查配置文件并将返回下面的信息:nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
10.在nginx-1.2.5目录下执行下面的命令来升级nginxmake upgrade
11.执行make upgrade得到一个错误:make: /etc/nginx/sbin/nginx: Command not found make: *** [upgrade] Error 127
12.用文本编辑器打开修改nginx-1.2.5目录下名为Makefile的文件,将upgrade节点中的/etc/nginx/sbin/nginx改为/usr/sbin/nginx -t,保存后关闭并重新执行make upgrade命令
13.执行nginx -v命令,程序的版本号已经是1.2.5,升级完毕.
相关文章推荐
- 安装Nginx
- centos搭建nginx环境
- Nginx-location常用配置
- nginx-lua get post请求小例子
- nginx 1.8.0下载
- 如何正确配置 Nginx+PHP
- 关于nginx解析不了php的问题
- 编译安装nginx-1.9.12
- nginx阻挡flv视频文件上传解决方案
- DEDECMS安全设置 执行php脚本限制设置方法(apache+nginx)
- 如何正确配置 Nginx+PHP
- nginx windows 版 创建windows 服务
- nginx+wsgi+flask配置
- Nginx 防盗链
- Nginx配置文件(nginx.conf)配置详解
- Linux服务器架设篇之(二)–源码安装Web服务器Nginx
- Linux笔记(63)——nginx负载均衡实现
- 使用Nginx+uWsgi实现Python的Django框架站点动静分离
- Nginx 防盗链
- 修改nginx服务器类型实现简单伪装(隐藏nginx类型与版本等)