centos 7 通过yum 安装 nginx
- 添加nginx存储库
sudo yum install epel-release
- 安装nginx
sudo yum install nginx
- 启动nginx
sudo systemctl start nginx
- 设置防火墙允许http和https通信
sudo firewall-cmd --permanent --zone=public --add-service=http sudo firewall-cmd --permanent --zone=public --add-service=https sudo firewall-cmd --reload
- 访问http://ip
- 设置nginx开机自启动
sudo systemctl enable nginx