一、环境准备
sudo yum install wget
sudo yum install -y gcc gcc-c++
sudo yum install perl
二、安装nginx依赖
- PCRE – Supports regular expressions. Required by the NGINX Core and Rewrite modules. PCRE有新旧版本,旧版本PCRE最新版本为8.43,新版本PCRE2最新版本10.33,有新特性都只会加到新版
wget https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz
tar -zxf pcre-8.43.tar.gz
cd pcre-8.43
./configure
make
sudo make install
- zlib – Supports header compression. Required by the NGINX Gzip module.
wget http://zlib.net/zlib-1.2.11.tar.gz
tar -zxf zlib-1.2.11.tar.gz
./configure
make
sudo make install
- OpenSSL – Supports the HTTPS protocol. Required by the NGINX SSL module and others.
wget http://www.openssl.org/source/openssl-1.1.1c.tar.gz
tar -zxf openssl-1.1.1c.tar.gz
cd openssl-1.1.1c
./Configure linux-x86_64 --prefix=/usr
make
sudo make install
三、安装nginx
wget http://hg.nginx.org/nginx/archive/4189160cb946.tar.gz
./auto/configure --prefix=/usr/local/nginx --pid-path=/user/local/nginx.pid --lock-path=/var/lock/nginx.lock --with-http_ssl_module --with-http_dav_module --with-http_flv_module --with-http_realip_module --with-http_gzip_static_module --with-http_stub_status_module --with-mail --with-mail_ssl_module --with-pcre=../pcre-8.00 --with-zlib=../zlib-1.2.11 --with-debug --http-client-body-temp-path=/var/tmp/nginx/client --http-proxy-temp-path=/var/tmp/nginx/proxy --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi --http-scgi-temp-path=/var/tmp/nginx/scgi
make
sudo make install
--prefix
--pid-path
--lock-path
--with-http_ssl_module
--with-http_dav_module
--with-http_flv_module
--with-http_realip_module
--with-http_gzip_static_module
--with-http_stub_status_module
--with-mail
--with-mail_ssl_module
--with-pcre=../pcre-8.11
--with-zlib=../zlib-1.2.5
--with-debug
--http-client-body-temp-path
--http-proxy-temp-path
--http-fastcgi-temp-path
--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi
--http-scgi-temp-path=/var/tmp/nginx/scgi
参考