Engineer-Exec04-参考解析

案例1:实现的防火墙配置
1)修改虚拟机 server0防火墙配置,将默认区域修改为trusted
2)修改虚拟机 desktop0防火墙配置,将默认区域修改为trusted

案例2:配置nfs文件夹共享,防火墙默认区域设置为trusted
在 server0 上发布共享文件夹
1)搭建nfs共享,实现共享本机/public
2)共享给所有人可以访问,并且具备只读权限
[root@server0 ~]# rpm -q nfs-utils
nfs-utils-1.3.0-0.el7.x86_64
[root@server0 ~]# mkdir /public
[root@server0 ~]# echo haha > /public/1.txt
[root@server0 ~]# vim /etc/exports
/nsd *(ro) #允许所有客户端以只读方式访问
[root@server0 ~]# systemctl restart nfs-server

在 desktop0 上访问共享文件夹
1)访问 server0 上发布共享/public,
2)实现开机自动挂载到/mnt/test
[root@desktop0 ~]# mkdir /mnt/test
[root@desktop0 ~]# showmount -e 172.25.0.11
Export list for 172.25.0.11:
/test
[root@desktop0 ~]# vim /etc/fstab
172.25.0.11:/public /mnt/test nfs defaults,_netdev 0 0
[root@desktop0 ~]# df -h
[root@desktop0 ~]# mount -a
[root@desktop0 ~]# df -h

案例3:为虚拟机 server 配置以下虚拟Web主机

  • 实现三个网站的部署
  • 实现客户端访问server0.example.com网页内容为 卖女孩的小火柴
  • 实现客户端访问www0.example.com网页内容为 奔跑吧骆驼
  • 实现客户端访问webapp0.example.com网页内容为 20里春风不如你

[root@server0 ~]# cd /var/www/
[root@server0 www]# mkdir shlss01 shlss02 shlss03
[root@server0 www]# echo ‘

卖女孩的小火柴’ > shlss01/index.html
[root@server0 www]# echo ‘

奔跑吧骆驼’ > shlss02/index.html
[root@server0 www]# echo ‘

20里春风不如你’ > shlss03/index.html
[root@server0 www]# vim /etc/httpd/conf.d/test.conf
<VirtualHost *:80>
ServerName server0.example.com
DocumentRoot /var/www/shlss01

<VirtualHost *:80>
ServerName www0.example.com
DocumentRoot /var/www/shlss02

<VirtualHost *:80>
ServerName webapp0.example.com
DocumentRoot /var/www/shlss03

[root@server0 www]# systemctl restart httpd
[root@desktop0 ~]# firefox server0.example.com
[root@desktop0 ~]# firefox www0.example.com
[root@desktop0 ~]# firefox webapp0.example.com

案例4:为虚拟机 server 使用自定Web根目录,设置SELinux为宽松模式
调整 Web 站点 http://server0.example.com 的网页目录,要求如下:
1)新建目录 /webroot,作为此站点新的网页目录
2)确保站点 http://server0.example.com 仍然可访问

[root@server0 ~]# setenforce 0
[root@server0 ~]# mkdir /webroot
[root@server0 ~]# echo '

500ml > 1000ml=1L ’ > /webroot/index.html
[root@server0 ~]# vim /etc/httpd/conf.d/test.conf
DocumentRoot “/webroot”
[root@server0 ~]# vim /etc/httpd/conf/httpd.conf

<Directory “/webroot”> #针对与/webroot进行访问控制
Require all granted #允许所有人访问


[root@server0 ~]# systemctl restart httpd
[root@server0 ~]# firefox server0.example.com
[root@desktop0 ~]# firefox server0.example.com

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值