centos7.6上部署nginx

1.更新系统包列表:

sudo yum update

2.安装 EPEL 仓库:

EPEL (Extra Packages for Enterprise Linux) 是一个为 CentOS 和其他 Red Hat 衍生系统提供的额外软件包仓库。Nginx 可能在 EPEL 中可用。

sudo yum install epel-release

3.安装 Nginx:

使用 YUM 安装 Nginx:

sudo yum install nginx

nginx的安装目录:/usr/share/nginx

4.启动 Nginx 服务:

启动 Nginx 服务,并设置它在系统启动时自动启动:

sudo systemctl start nginx
sudo systemctl enable nginx

5.验证 Nginx 是否正在运行

sudo systemctl status nginx

6.配置防火墙:

如果你的系统使用的是 firewalld,则需要允许 HTTP 和 HTTPS 服务:(非必须)

sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

7.测试安装:

打开 Web 浏览器并访问服务器的 IP 地址或域名以确认 Nginx 已成功安装:

http://ip
posted @ 2024-07-25 13:53  测试微思录-静水流深  阅读(34)  评论(0)    收藏  举报