
同上篇文章相同使用yum或者dnf 包管理器几步完成安装nginx打开终端依次执行以下命令# 更新软件包缓存 可选 sudo yum makecache #安装Nginx sudo yum install nginx -y #启动Nginx服务 sudo systemctl start nginx #设置开机自启 sudo systemctl enable nginx #确认正常运行 sudo systemctl status nginx #显示activerunning即为正常运行开放防火墙防火墙放行HTTP 和HTTPS 服务sudo firewall-cmd --permanent --add-servicehttp #开放http(80) sudo firewall-cmd --permanent --add-servicehttps #开放https(443) sudo firewall-cmd --reload #重载防火墙验证安装#本地使用curl测试 curl -I http://localhost #或者打开浏览器直接方位服务器IP地址即可 #如果返回 HTTP/1.1 200 OK说明 Nginx 已正常工作 #看到Nginx的欢迎页面同上补充网站根目录默认存放位置在/usr/share/nginx/html配置文件#主配置文件 /etc/nginx/nginx.conf #站点配置文件通常在该目录下 /etc/nginx/conf.d/使用该方法不需要手动安装依赖包yum或者dnf作为包管理工具具备自动依赖解析功能会自动检测下载安装 只要你的openEuler 能联网且配置了正常的软件源