基于http搭建网站 firewall&selinux开启

1.要求搭建web服务器通过端口8909能够访问到网页内容为“小胖,你咋这么胖呢!”
2.建立httpd服务器,要求:
提供两个基于名称的虚拟主机:
(a)www1.stuX.com,页面文件目录为/web/vhosts/www1;错误日志为/var/log/httpd/www1.err,访问日志为/var/log/httpd/www1.access;
(b)www2.stuX.com,页面文件目录为/web/vhosts/www2;错误日志为/var/log/httpd/www2.err,访问日志为/var/log/httpd/www2.access;
©为两个虚拟主机建立各自的主页文件index.html,内容分别为其对应的主机名;

注意:要求防火墙启用,SELinux开启
配置一:
1.配置本地安装光盘为安装源
[root@kaikai~]# mount /dev/sr0 /mnt
2、安装web软件
[root@kaikai ~]# yum install httpd -y
3、启动服务
[root@kaikai ~]# systemctl enable --now httpd
4、防火墙和selinux设置
在这里插入图片描述
在这里插入图片描述

5.创建目录编辑网页内容,编辑子配置文件
[root@kaikai ~]# mkdir /aaa
[root@kaikai ~]# echo “小胖,你咋这么胖呢?” > /aaa/index.html
在这里插入图片描述
6.重启服务测试
[root@kaikai ~]# systemctl restart httpd
客户端测试:在这里插入图片描述
配置二:
1、增加一个ip地址
[root@kaikai ~]# nmcli connection modify eno16777736 +ipv4.address 192.168.233.141/24
[root@kaikai ~]# nmcli connection up eno16777736
[root@kaikai ~]# nmcli con reload
2、创建网页目录结构
[root@kaikai html]# mkdir /web/vhosts/www{1,2} -p
3、虚拟主机网页
[root@kaikai html]# echo www1 > /web/vhosts/www1/index.html
[root@kaikai html]# echo www2 > /web/vhosts/www2/index.html
4、编辑子配置文件
[root@kaikai ~]# vim /etc/httpd/conf.d/vhosts.conf
在这里插入图片描述
5.防火墙和selinux,重启服务
[root@kaikai html]# chcon -R -t httpd_sys_content_t /web
[root@kaikai html]# systemctl restart httpd
6==.客户端添加域名解析==
在这里插入图片描述
7.测试在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值