Linux下升级Nginx版本

这篇博客介绍了如何在Linux系统中升级Nginx的详细过程,包括下载新版本的Nginx包,获取旧版本的configure选项,解决编译过程中遇到的依赖问题,如libpcre3-dev、libxml2、libxslt、GD库、Perl模块ExtUtils::Embed和GeoIP库。通过安装缺失的依赖并执行make和make install,最后重启Nginx服务来完成升级。

1.下载新版本nginx包

http://nginx.org/en/download.html

2.获取旧版本nginx的configure选项

/opt/nginx/sbin/nginx -V

3.进入新版本nginx解压后的目录,初始编译nginx,编译参数为第2步获取到的旧版本的参数

4.编译遇错(1)


解决方法:

ubuntu下执行

apt-get install libpcre3-dev

RHEL下执行

yum -y install pcre-devel

5.编译遇错(2)

./configure: error: the HTTP XSLT module requires the libxml2/libxslt

libraries. You can either do not enable the module or install the libraries.

解决办法:

Ubuntu

sudo apt-get install libxml2 libxml2-dev

RHEL

yum install libxslt-devel

6.遇错(3)

./configure: error: the HTTP image filter module requires the GD library.

You can either do not enable the module or install the libraries.

解决办法:

Ubuntu

yum install gd-devel

RHEL

apt-get install libgd2-xpm libgd2-xpm-dev

7.遇错(4)

./configure: error: perl module ExtUtils::Embed is required

解决办法:

yum install perl perl-devel perl-ExtUtils-Embed

8.遇错(5)

./configure: error: the GeoIP module requires the GeoIP library.

You can either do not enable the module or install the library.

解决办法:

Ubantu

sudo apt-get install geoip-database libgeoip-dev

RHEL

yum install GeoI GeoIP-data GeoIP-devel

9.编译

make

10.拷贝命令

mv /usr/sbin/nginx  /usr/sbin/nginx.1.2.0.bak

cp /opt/nginx-1.6.3/objs/nginx  /usr/sbin/nginx

11.编译安装

make install

12.重启nginx

service nginx restart


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值