Centos 安装 Nginx

Centos 安装 Nginx

1、 EPEL 仓库中有 Nginx 的安装包。如果你还没有安装过 EPEL,可以通过运行下面的命令来完成安装:
yum install epel-release
2、 输入以下命令来安装 Nginx:
yum install nginx
3、 等到安装完成以后,可以通过以下命令来设置开机启动和运行 Nginx 服务:
设置 Nginx 开机启动:
systemctl enable nginx
💡
运行以上命令以后,会输出类似以下的内容,表示创建了一个软连接来关联 Nginx
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
启动 Nginx:
systemctl start nginx
检查 Nginx 的运行状态:
systemctl status nginx