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. 根據(jù)提示安裝對(duì)應(yīng)的依賴包
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. 升級(jí)
前幾步一樣抬吟,編譯安裝的時(shí)候携悯,只編譯 make危融。
然后復(fù)制objs目錄下的nginx 到安裝目錄
[root@honeybee nginx-1.12.2]# cp objs/nginx /usr/local/nginx/sbin/