NFS与WEB的综合实验

题目如下:

配置nfs服务器和web服务器
1.配置nfs服务器,要求将两个网站的资源文件通过nfs服务器共享给web服务器。
通过两个共享目录分别网页文件例如:/openlab/index.html
      /xianoupeng/index.html (网页文件内容自定义)。
2.通过nfs共享网页文件,配置web服务实现www.openlab.com以及www.xianoupeng.com访问各自的网站信息。

分两个步骤,一个是在NFS服务器上,另一个在WEB服务器上,用到两台linux虚拟机

NFS上:

1.确认服务是否已经安装

[root@NFS ~]# rpm -q rpcbind
[root@NFS ~]# rpm -q nfs-utils

 

如果没有安装,先挂载,再执行yum install rpcbind -y和yum install nfs-utils -y
2.启动服务

[root@NFS ~]# systemctl start nfs-server
[root@NFS ~]# systemctl stop firewalld
[root@NFS ~]# setenforce 0

3.创建目录

[root@NFS ~]# mkdir /openlab
[root@NFS ~]# mkdir /xianoupeng
[root@NFS ~]# echo this is openlab > /openlab/index.html
[root@NFS ~]# echo this is xianoupeng > /xianoupeng/index.html

4.写共享目录的路径

[root@NFS ~]# vim /etc/exports

 *代表所有客户端都有读写权限,可以写具体的主机ip

6.

[root@NFS ~]# exportfs -ar或者systemctl restart nfs-server

在WEB服务器上:

先安装httpd服务,详情请看我前两条blog

1.创建两个挂在目录,然后挂载

[root@WEB ~]# mkdir /copenlab
[root@WEB ~]# mkdir /cxianoupeng

[root@WEB ~]# mount 192.168.28.129:/xianoupeng /cxianoupeng
[root@WEB ~]# mount 192.168.28.129:/openlab /copenlab

2.配置文件

[root@WEB ~]# vim /etc/httpd/conf.d/vhost.conf

 3.在hosts下添加

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

 

测试结果:

 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值