linux 下通过 httpd服务创建网页
1.安装httpd服务
yum install httpd -y
[root@node143 ~]# yum install httpd -y
2.查看防火墙状态
[root@node143 ~]# systemctl is-enabled firewalld
enabled
3.防火墙允许httpd服务
[root@node143 ~]# firewall-cmd --permanent --add-service=http
success
4.刷新防火墙状态
[root@node143 ~]# firewall-cmd --reload
success
5.编写http协议(实现永久有效)
vim /etc/httpd/conf/httpd.conf
Esc:/ 输入/ServerName 查找
加入新的服务器名称(192.168.8.143 注意:没有间隔)
5.1 echo “你好,欢迎你的到来” > /var/www/html/index.html 在http中写文件
[root@node143 ~]# echo “你好,欢迎你的到来” > /var/www/html/index.html
5.2 ip a 查看IP地址,就可以看见ens32的IP地址,这个就是自己主机访问自己创建网页的IP地址。
6.systemctl restart httpd—防火墙允许httpd服务通过
[root@node143 ~]# systemctl restart httpd