CentOS_8安装Nginx
CentOS_8安装Nginx
首先添加 EPEL
存储库
sudo dnf install -y epel-release
安装Nginx
sudo dnf install -y nginx
验证安装
sudo nginx -v
配置开启启动并直接启动
sudo systemctl enable nginx --now
检查 Nginx 是否运行
curl -I 127.0.0.1
输出类似到内容
HTTP/1.1 200 OK
Server: nginx/1.14.1
Date: Sun, 02 Apr 2023 06:15:41 GMT
Content-Type: text/html
Content-Length: 3429
Last-Modified: Thu, 10 Jun 2021 09:09:03 GMT
Connection: keep-alive
ETag: "60c1d6af-d65"
Accept-Ranges: bytes
配置防火墙策略,允许Web访问
sudo firewall-cmd --zone=public --add-service=http --permanent
sudo firewall-cmd --zone=public --add-service=https --permanent
sudo firewall-cmd --reload