CentOS 8 上安装和配置 nginx

1、检查yum上的nginx版本

yum info nginx

2、安装nginx

yum install nginx
安装过程有时会询问是否安装,输入y回车即可

3、将服务设置为每次开机启动

sudo systemctl enable nginx

4、启动nginx服务

sudo systemctl start nginx

5、查看nginx服务状态

sudo systemctl status nginx

6、检查防火墙状态

firewall-cmd --state

7、设置防火墙,添加80、443端口

sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https

8、重新加载防火墙配置

sudo firewall-cmd --reload

9、验证nginx

在浏览器中输入nginx的访问地址,如出现nginx欢迎页时配置成功。

posted @ 2021-09-29 16:33  dcrenl  阅读(947)  评论(0编辑  收藏  举报