centos 7 通过yum 安装 nginx

  1. 添加nginx存储库
    sudo yum install epel-release
  2. 安装nginx
    sudo yum install nginx
  3. 启动nginx
    sudo systemctl start nginx
  4. 设置防火墙允许http和https通信
    sudo firewall-cmd --permanent --zone=public --add-service=http 
    sudo firewall-cmd --permanent --zone=public --add-service=https
    sudo firewall-cmd --reload
  5. 访问http://ip  
  6. 设置nginx开机自启动
    sudo systemctl enable nginx
原文地址:https://www.cnblogs.com/YellowstonePark/p/8862280.html