1.官网下载源码包
2.安装依赖
[root@xuegod13 src]# yum -y install gcc gcc-c++ autoconf automake zlib zlib-devel openssl openssl-devel pcre pcre-devel
3.添加nginx用户
[root@xuegod13 src]# useradd -s /sbin/nologin -M nginx
4.编译安装
[root@xuegod13 src]# cd ..
[root@xuegod13 nginx-1.18.0]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_gzip_static_module --with-http_dav_module --with-http_stub_status_module --with-http_addition_module --with-http_sub_module --with-http_flv_module --with-http_mp4_module --with-pcre
[root@xuegod13 nginx-1.18.0]# make -j 4 && make install