魏蓝

以梦为马

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

NFS服务 LAP+MySQL+NFS

一、环境准备

10.0.0.16 mariadb
10.0.0.14 nfs
10.0.0.22 web

二、配置

1.配置数据库10.0.0.16

yum install -y mariadb-server
mysql
MariaDB [(none)]> create database wordpress;
MariaDB [(none)]> create user wordpress@'10.0.0.%' identified by '123456';
MariaDB [(none)]> grant all on wordpress.* to wordpress@'10.0.0.%';

2.配置nfs10.0.0.14

复制代码
mkdir /data/wordpress
chmod 777 /data/wordpress/
wget https://cn.wordpress.org/latest-zh_CN.tar.gz
tar xf latest-zh_CN.tar.gz
mv wordpress/* /data/wordpress/
vim /etc/exports
/data/wordpress 10.0.0.0/24(rw)
yum install nfs-utils -y
systemctl enable --now nfs-server
复制代码

3.配置web10.0.0.22

复制代码
yum install php-fpm php-mysqlnd php-json
yum install httpd
systemctl enable --now httpd php-fpm
yum install nfs-utils
vim /etc/fstab
10.0.0.14:/data/wordpress /var/www/html nfs _netdev 0 0
showmount -e 10.0.0.14
mount -a
ls /var/www/html
systemctl enable --now nfs-server
复制代码

 

 三、优化

1.web10.0.0.22

umount /var/www/html
rm -rf /var/www/html/*

2.nfs10.0.0.14

scp /data/wordpress/wp-config.php 10.0.0.18:/var/www/html/

3.web10.0.0.22

复制代码
vim /etc/fstab
10.0.0.14:/data/wordpress/wp-content/uploads /var/www/html/wp-content/upload nfs _netdev 0 0
mkdir /var/www/html/wp-content/uploads -p
cp -av wordpress/* /var/www/html
chown -R apache.apache /var/www/html
usermod -u 88 www
groupmod -g 88 www
chown -R www.www /data/wordpress/wp-content/
vim /etc/exports
/data/wordpress 10.0.0.0/24(rw,all_squash,anonuid=88,anongid=88)
exportfs -r
exportfs -v
复制代码

 

 

 

 

posted on   魏蓝  阅读(61)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示