1. 为nginx创建用户及用户组
groupadd nginx
useradd nginx -g nginx -s /sbin/nologin -M
2. 在编译的时候配置用户及用户组
--user=nginx
--group=nginx
3. 安装依赖库
yum -y install gcc automake autoconf libtool make gcc-c++ wget
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.38.tar.gz && tar -zxf pcre-8.38.tar.gz
wget http://zlib.net/zlib-1.2.11.tar.gz && tar -zxf zlib-1.2.11.tar.gz
wget https://www.openssl.org/source/openssl-1.0.2l.tar.gz && tar -zxf openssl-1.0.2l.tar.gz
4. 编译安装nginx
wget http://nginx.org/download/nginx-1.14.1.tar.gz && tar -zxvf nginx-1.14.1.tar.gz && cd nginx-1.14.1
./configure \
--with-http_ssl_module \
--with-pcre=/root/pcre-8.38 \
--with-zlib=/root/zlib-1.2.11 \
--with-openssl=/root/openssl-1.0.2l \
--user=nginx \
--group=nginx
make -j `grep processor /proc/cpuinfo | wc -l` && make install