#下载地址:nginx: download
#安装依赖库
yum -y install gcc zlib zlib-devel pcre-devel openssl openssl-devel
#上传至服务器解压
tar zxvf nginx-1.18.0.tar.gz
#进入nginx目录
cd nginx-1.18.0
#执行命令
groupadd nginx
useradd -g nginx -s /sbin/nologin nginx
./configure --prefix=/usr/local/nginx --user=nginx --group=nginx --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-pcre --with-stream --with-stream_ssl_module --with-stream_realip_module
make && make install
#开启防火墙
firewall-cmd --zone=public --add-port=80/tcp --permanent //开启端口
firewall-cmd --reload //重启防火墙
#访问IP测试是否成功