以下安装步骤需要root权限。
1. 添加CentOS 7 EPEL 仓库
sudo yum install epel-release
2. 安装Nginx
sudo yum install nginx
3. 启动Nginx
sudo systemctl start nginx
4. 启动防火墙
sudo systemctl start firewalld.service
5. 允许HTTP和HTTPS传输
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload