1. 下载安装文件到 /usr/local/src/
[root@honeybee ~]# cd /usr/local/src/
[root@honeybee src]# wget http://nginx.org/download/nginx-1.12.2.tar.gz
2. 解压压缩包
[root@honeybee src]# tar -zxf nginx-1.12.2.tar.gz
3. 配置安装文件
[root@honeybee src]# cd nginx-1.12.2/
[root@honeybee nginx-1.12.2]# ./configure --with-http_ssl_module --with-http_stub_status_module
4. 根据提示安装对应的依赖包
1. 缺少PCRE
./configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.
安装PCRE
[root@honeybee nginx-1.12.2]# yum install -y pcre pcre-devel
2. 缺少OpenSSL
./configure: error: SSL modules require the OpenSSL library.
You can either do not enable the modules, or install the OpenSSL library
into the system, or build the OpenSSL library statically from the source
with nginx by using --with-openssl=<path> option.
安装OpenSSL
[root@honeybee nginx-1.12.2]# yum install -y openssl openssl-devel
5. 编译安装
[root@honeybee nginx-1.12.2]# make
[root@honeybee nginx-1.12.2]# make install
6. 升级
前几步一样,编译安装的时候,只编译 make。
然后复制objs目录下的nginx 到安装目录
[root@honeybee nginx-1.12.2]# cp objs/nginx /usr/local/nginx/sbin/
网友评论