考试系统与NHS文件共享

考试系统与NHS文件共享


 

首先我们要搭建web服务环境

安装web软件

1、安装web软件
[root@web01 opt]# yum install httpd php php-devel -y

2、将代码放置于网站的根目录
[root@web01 opt]# cd /var/www/html/

# 上传代码
上传源代码包
解压源代码包:unzip

3、授权
[root@web01 html]# chown -R www.www /var/www/html

4、关闭selinux和防火墙
[root@nfs ~]# setenforce 0
[root@nfs ~]# systemctl disable --now firewalld

5、修改web软件的用户
[root@web01 html]# vim /etc/httpd/conf/httpd.conf
User www
Group www

6、启动web软件
[root@web01 html]# systemctl start httpd

7、测试

    1、上传
    
    2、访问
    http://172.16.1.7/upload/1_linux.jpg

NFS文件共享


1、修改NFS配置文件
[root@nfs nfs1]# vim /etc/exports
/web/upload  172.16.1.0/20(rw,sync,all_squash,anonuid=666,anongid=666)

2、创建挂载点
[root@nfs nfs1]# mkdir /web/upload
[root@nfs nfs1]# chown www.www /web/upload

3、重启NFS
[root@nfs nfs1]# systemctl restart nfs-server rpcbind

4、客户端安装NFS软件
[root@web01 html]# yum install nfs-utils -y
[root@web02 html]# yum install nfs-utils -y
[root@web03 html]# yum install nfs-utils -y

5、挂载
[root@web01 html]# mount -t nfs 172.16.1.31:/web/upload /var/www/html/upload
[root@web02 html]# mount -t nfs 172.16.1.31:/web/upload /var/www/html/upload
[root@web03 html]# mount -t nfs 172.16.1.31:/web/upload /var/www/html/upload

6、测试
用web2上传,web3查看

 

posted @ 2021-12-30 17:26  Roseblacko  阅读(31)  评论(0编辑  收藏  举报