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

被折叠的 条评论
为什么被折叠?



