mkdir -p /home/app
cd /home/app
wget http://nginx.org/download/nginx-1.24.0.tar.gz
tar -zxf nginx-1.24.0.tar.gz
yum install gcc-c++ pcre pcre-devel zlib zlib-devel openssl openssl-devel -y
cd nginx-1.24.0
./configure --prefix=/home/app/nginx --with-http_stub_status_module --with-http_ssl_module
## --prefix 指定nginx的安装目录
## --with-http_stub_status_module 启用ngx_http_stub_status_module 支持查看nginx的状态页。
## --with-http_ssl_module 启用https支持
## 其他参数视情况设置,具体可以通过./configure --help 来查看参数详情
make && make install
cd /home/app/nginx/sbin
./nginx
# 开放80端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
#关闭80端口
firewall-cmd --zone=public --remove-port=80/tcp --permanent
# 配置立即生效
firewall-cmd --reload
# 重启防火墙
service firewalld restart
# 查看已开放的端口
firewall-cmd --list-ports

cd /home/app/nginx/sbin
./nginx -s stop