1、添加EPEL软件库
首先要添加 CentOS 7 EPEL 软件库,然后使用 yum 命令安装扩展组件软件库:
yum install epel-release
2、安装nginx
安装好软件库后,就可以使用yum命令安装nginx
yum install nginx
3、运行nginx
systemctl start nginx
使用systemctl status检查nginx运行状态
systemctl status nginx

4、设置防火墙
如果开启了防火墙需要将80和443端口打开
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
在浏览器里访问你的地址,如果看到以下页面就ok。
