CentOS 7安装Nginx 1.10.2

安装epel-release源并进行安装

yum install epel-release
yum update(时间会有点长)
yum install nginx

相关操作:

systemctl status nginx #查看运行状态
systemctl start nginx #启动
systemctl stop nginx #停止
systemctl restart nginx #重启
systemctl enable nginx #开机启动
 

设置防火墙

在启动完以后可能无法通过IP访问,需要进一步设置防火墙

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload

原文地址:https://www.cnblogs.com/lic1005/p/8026579.html