CentOS 8.0 安装 Nginx

一、先更新YUM源,具体方法可以百度一下

二、安装Nginx

[root@localhost ~]# yum install nginx

三、设置防火墙,放通http服务

[root@localhost ~]# firewall-cmd --permanent --add-service=http

[root@localhost ~]# firewall-cmd --reload

四、设置防火墙,开机自动启动

[root@localhost ~]# systemctl enable firewalld

五、运行Nginx,并设置开机自动启动

[root@localhost ~]# systemctl start nginx.service

[root@localhost ~]# systemctl enable nginx.service