小白的linux学习笔记10:安装nginx和第一个网页

sudo yum install nginx

sudo systemctl status nginx

sudo systemctl start nginx

检查端口:netstat -tlpn

sudo hostname -I | awk '{print $1}'  //获取主机ip

https://www.linuxidc.com/Linux/2019-11/161440.htm

正常的话就可以通过浏览器输入ip访问默认nginx网页了。

如果不行关闭防火墙systemctl stop firewalld,可以了,说明防火墙问题。

修改防火墙规则:

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

访问成功。

如果想把默认网页换成自己的,替换掉/usr/share/nginx/html目录下的内容。done。

猜你喜欢

转载自www.cnblogs.com/cityfckr/p/12365717.html