1. 安装
sudo yum update -y # 更新软件包
sudo yum install nginx -y # 安装
sudo systemctl start nginx # 启动
sudo systemctl enable nginx # 开机自启
sudo systemctl status nginx # 检查状态
sudo firewall-cmd --permanent --add-service=http # 允许http流量通过防火墙
sudo firewall-cmd --permanent --add-service=https # 允许https流量通过防火墙
sudo firewall-cmd --reload # 重新加载防火墙
sudo systemctl restart nginx # 重新启动 Nginx
nginx -v # 查看版本
which nginx # 查看位置
whereis nginx # 查看位置
rpm -ql nginx # 查看位置
2. 访问
浏览器里输入loccalhost 或地址,显示 Nginx 欢迎页面即安装成功。