赞
踩
# 一、准备数据共享机
# 安装nfs
yum install -y nfs-utils
# 启动nfs
systemctl start nfs-server
# 查看状态
systemctl status rpcbind
# 添加共享网段
vim /etc/exports
/data/sgame 10.0.0.4(rw)
/data/linuxcmd 10.0.0.5(rw)
/data/opsite 10.0.0.2(rw)
#重启服务
systemctl restart nfs
# 查看
exportfs -v
/data/sgame 10.0.0.4(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)
/data/linuxcmd 10.0.0.5(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)
/data/opsite
10.0.0.2(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)
# 给data目录授权
setfacl -m u:nfsnobody:rwx /data/sgame
setfacl -m u:nfsnobody:rwx /data/linuxcmd
setfacl -m u:nfsnobody:rwx /data/opsite
# 查看
getfacl /data/sgame
getfacl /data/linuxcmd
getfacl /data/opsite
=======================================================
# 二、客户端
## 安装nfs
yum install nfs-utils -y
## 查看连接(填服务端IP)
showmount -e 10.0.0.3
Export list for 10.0.0.3:
/data (everyone)
## 将服务端/data目录下文件挂载到本机 /var/www/html 目录下
mount 10.0.0.3:/data/littlegames /var/www/html
## 启动httpd服务
systemctl start httpd
## 查看 df -h
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 898M 0 898M 0% /dev
tmpfs 910M 0 910M 0% /dev/shm
tmpfs 910M 9.6M 901M 2% /run
tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/mapper/centos-root 37G 5.0G 32G 14% /
/dev/sr0 4.4G 4.4G 0 100% /localrepo
/dev/sda1 1014M 151M 864M 15% /boot
tmpfs 182M 0 182M 0% /run/user/0
10.0.0.3:/data/sgame 37G 5.4G 32G 15% /apps/nginx/html
==========================================================
# 三、Nginx反向代理
## 三台机器分别安装nginx
yum install nginx -y
###### 三台web服务分别配置 ######
### 小游戏平台
location / {
root /apps/nginx/html/littlesgamee;
index index.html ;
}
### 运维管理系统
location / {
root /apps/nginx/html/运维管理系统/dashgum/;
index index.html index.htm;
}
### Linux命令手册
location / {
root /apps/nginx/html/Linux命令手册;
index index.html index.htm;
}
## 通过IP地址访问web界面
########## 代理服务器配置 ##########
======================= web01.conf =======================
[root@centos7 ~]#vim /apps/nginx/conf/conf.d/web01.conf
server {
listen 81;
server_name www.web01.com;
location / {
proxy_pass http://10.0.0.4/littlegames/;
}
}
======================= web02.conf =======================
[root@centos7 ~]#vim /apps/nginx/conf/conf.d/web02.conf
server {
listen 82;
server_name www.web02.com;
location / {
proxy_pass http://10.0.0.5;
}
}
======================= web03.conf =======================
[root@centos7 ~]#vim /apps/nginx/conf/conf.d/web03.conf
server {
listen 83;
server_name www.web03.com;
location / {
proxy_pass http://10.0.0.2;
}
}
# 域名解析
![image.png](/upload/2023/08/image-c573f917712c49d79484bccd19418dd5.png)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。