您的位置:首页 > 新闻 > 会展 > web服务器搭建练习

web服务器搭建练习

2025/3/13 14:50:39 来源:https://blog.csdn.net/LOXOI/article/details/140751715  浏览:    关键词:web服务器搭建练习

练习要求:

搭建一个web服务器,客户端通过www.haha.com访问该网站时能够看到内容:this is haha

完成过程:

1. 创建新ip,重启ens

[root@localhost ~]# nmtui
[root@localhost ~]# nmcli connection up ens160

2.创建目录,写入要求内容

[root@localhost ~]# mkdir -p /www/haha
[root@localhost ~]# echo this is haha > /www/haha/index.html

3.DNS解析配置 

[root@localhost ~]# vim /etc/hosts

4.配置server 

[root@localhost ~]# vim /etc/nginx/conf.d/haha.conf

5.关闭防火墙,重启nginx服务 ,确认gentenforce状态

[root@localhost ~]# systemctl status firewalld --now        #关闭防火墙
[root@localhost ~]# systemctl restart nginx                 #重启nginx服务
[root@localhost ~]# getenforce
Permissive

6.测试

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com