#部署编译环境
yum install -y wget
yum install -y vim-enhanced
yum install -y gcc gcc-c++
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel
yum install -y openssl openssl-devel
#下载安装nginx
cd /usr/local
wget http://nginx.org/download/nginx-1.14.0.tar.gz //1.14.0是目前最新的稳定版本
tar -zxvf nginx-1.14.0.tar.gz //解压
cd nginx-1.14.0
./configure --prefix=/usr/local/nginx --with-pcre --with-http_stub_status_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module //编译时添加的一些模块
make && make install //安装
#启动关闭nginx
#查看配置是否正确
/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx
#配置防火墙
firewall-cmd --zone=public --add-port=80/tcp --permanent //nginx默认的防火墙端口是80
firewall-cmd --reload
三、编写完成