2019.9.18 nfs共享与动静分离

1,先把服务器A设置共享文件

[root@localhost ~]# rpm -q nfs-utils rpcbind              //共享与被共享服务器都需要对应软件包 nfs-utils rpcbind 
nfs-utils-1.3.0-0.48.el7.x86_64
rpcbind-0.2.0-42.el7.x86_64
[root@localhost ~]# mkdir /wwwroot                       //创建共享目录
[root@localhost ~]# vim /etc/exports

  /wwwroot 192.168.200.111(rw)                //设置给哪些服务器共享
[root@localhost ~]# systemctl restart rpcbind.socket           //重启
[root@localhost ~]# systemctl restart nfs       //重启
[root@localhost ~]# cd /wwwroot/
[root@localhost wwwroot]# ls                          //之后就下载对应文件到共享目录下把吧
[root@localhost wwwroot]# rz
z waiting to receive.**B0100000023be50

2,确保被共享服务器有对应软件包和挂载共享目录

[root@localhost ~]# rpm -q nfs-utils rpcbind              //共享与被共享服务器都需要对应软件包 nfs-utils rpcbind 
nfs-utils-1.3.0-0.48.el7.x86_64
rpcbind-0.2.0-42.el7.x86_64

[root@localhost ~]# showmount -e 192.168.200.113
Export list for 192.168.200.113:                                          //查看共享信息
/wwwroot 192.168.200.111

[root@localhost ~]#  mkdir /usr/local/nginx/html/images     //创建挂载点

[root@localhost ~]# mount 192.168.200.113:/wwwroot /usr/local/nginx/html/images/       //挂载共享目录

 

1, 共需要3个服务器,一台是安装好了nginx,ip是192.168.200.112

 [root@nginx ~]# vim /usr/local/nginx/conf/nginx.conf

location ~* \.php$ {                                     //实现动态分离,别人在192.168.200.112上面访问/bbs/index.php 就跳转到192.168.200.111上面去                        
proxy_pass http://192.168.200.111;
}

2,还有一台是搭建好了LNMP,ip是192.168.200.111

 

}[root@localhost ~]# vim /usr/local/nginx/conf/nginx.conf
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi.conf;
}

 

}
}

 

3,还有一台是最上面配置好了nfs共享的服务器。

 

posted on 2019-09-18 21:05  像鱼拥抱大海  阅读(191)  评论(0编辑  收藏  举报

导航