实现NFS共享wordpress
author:JevonWei
版权声明:原创作品
- 两台Web服务器,一台mysql服务器,一台NFS服务器,一台DNS服务器
拓扑结构

拓扑环境
web1 192.168.198.110
web2 192.168.198.120
mysql 192.168.198.130
DNS 192.168.198.10
NFS 192.168.198.131
web1 192.168.198.110
[root@danran ~]# yum -y install httpd php php-mysql
[root@danran ~]# service httpd restart
[root@danran ~]# chkconfig httpd on
[root@danran ~]# setenforce 0
[root@danran ~]# iptables -F
web1 192.168.198.120
[root@danran ~]# yum -y install httpd php php-mysql
[root@danran ~]# service httpd restart
[root@danran ~]# chkconfig httpd on
[root@danran ~]# setenforce 0
[root@danran ~]# iptables -F
mysql 192.168.198.130
[root@danran ~]# yum -y install mariadb mariadb-server
[root@danran ~]# systemctl start mariadb
[root@danran ~]# systemctl enable mariadb
[root@danran ~]# iptables -F
[root@danran ~]# setenforce 0
[root@danran ~]# mysql_secure_installation \\设置数据库安全规则
[root@danran ~]# mysql -uroot -pdanran
MariaDB [(none)]> create database nfsdb;
MariaDB [(none)]> grant all on *.* to nfs@'192.168.198.120' identified by 'danran'; \\授予web服务器连接数据库
grant all on *.* to nfs@'192.168.198.110' identified by 'danran'; \\授予web服务器连接数据库
DNS 192.168.198.10
[root@danran ~]# yum -y install bind
[root@danran ~]# systemctl start named
[root@danran ~]# systemctl enable named
[root@danran ~]# setenforce 0
[root@danran ~]# iptables -F
[root@danran ~]# vim /etc/named.conf
options {
listen-on port 53 { localhost; };
allow-query { any; };
[root@danran ~]# vim /etc/named.rfc1912.zones
zone "danran.com" IN {
type master;
file "danran.zome";
allow-update { none; };
}
[root@danran ~]# cp -p /var/named/named.localhost /var/named/danran.zone
[root@danran ~]# vim /var/named/danran.zone
NS ns
$TTL 1D
@ IN SOA ns.danran.com dns.danran.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS ns
ns A 192.168.198.10
websrv A 192.168.198.110
websrv A 192.168.198.120
mysql A 192.168.198.130
www CNAME websrv
[root@danran ~]# named-checkconf
[root@danran ~]# named-checkzone "danran.com" /var/named/danran.zone
[root@danran ~]# systemctl restart named
NFS 192.168.198.131
[root@danran app]# mkdir nfs
[root@danran app]# ls
nfs
[root@danran app]# chmod o+w nfs/
[root@danran app]# useradd -r nfsuser -s /sbin/nologin
[root@danran app]# vim /etc/exports \\将/app/nfs目录共享给192.168.198.110和192.168.198.120两台web服务器
/app/nfs 192.168.198.110(rw,all_squash,anonuid=991,anongid=986) 192.168.198.120(rw,all_squash,anonuid=991,anongid=986)
[root@danran app]# systemctl restart nfs
[root@danran app]# systemctl restart rpcbind
[root@danran app]# firewall-cmd --add-service=nfs --permanent
[root@danran app]# firewall-cmd --add-service=rpc-bind --permanent
[root@danran app]# firewall-cmd --reload
[root@danran app]# setenfore 0
[root@danran app]# iptables -F
web1和web2 192.168.198.110/120挂载NFS目录
[root@danran html]# vim /etc/fstab
192.168.198.131:/app/nfs /var/www/html nfs defaults 0 0
[root@danran html]# mount -a
在NFS服务器192.168.198.131的/app/nfs共享目录安装wordpress
tar xvf wordpress-4.8-zh_CN.tar.gz
mv wordpress /app/nfs/blog
cd /app/nfs/blog
setfacl -m u:nfsuser:rwx blog/ \\因为所有远程用户都映射为了nfsuser,故授予nfsuserrwx权限
或
chmod o+w blog
setfacl -m u:daemon:rwx blog/
或
cp wp-config-sample.php wp-config.php
vim wp-config.php
define('DB_NAME', 'nfsdb');
define('DB_USER', 'nfs');
define('DB_PASSWORD', 'danran');
define('DB_HOST', '192.168.198.130');
两台web服务器上编译安装xcache
下载xcache-3.2.0.tar.bz2
tar xf xcache-3.2.0.tar.bz2
cd xcache-3.2.0
/app/php/bin/phpize 生成编译环境.configure脚本
./configure --enable-xcache --with-php-config=/app/php/bin/php-config
make && make install
注意最后结果的一行目录
ls /app/php/lib/php/extensions/no-debug-non-zts-20131226/xcache.so
mkdir /etc/php.d/
cp xcache.ini /etc/php.d/
vim /etc/php.d/xcache.ini
[xcache-common]
修改
extension = /app/php/lib/php/extensions/no-debug-non-zts-20131226/xcache.so
service httpd restart
登录web服务器测试
www.danran.com/blog
实现NFS共享wordpress的更多相关文章
- centos7下利用nfs搭建wordpress
拓扑环境 web1 192.168.198.110 web2 192.168.198.120 mysql 192.168.198.130 DNS 192.168.198.10 NFS 192.168. ...
- ubuntu下建立NFS共享,并用开发板挂载
安装NFS服务 apt-get install nfs-kernel-server nfs-common apt-get install portmap 在/etc/exports里加入 /home/ ...
- 生产场景NFS共享存储优化及实战
生产场景NFS共享存储优化: 1.硬件:sas/ssd磁盘,买多块,raid0/raid10,网卡好 2.NFS服务器端优化加all_squash,async /backup/NFS 192.168. ...
- Suse 创建NFS共享目录
Suse 创建NFS共享目录 服务端的配置: 1.编辑nfs服务的配置文件 /software/suse11 *(rw,sync,no_root_squash,no_all_squash) 凝视: / ...
- linux的mount(挂载)NFS 共享,命令详解
Linux下挂载(mount)光盘镜像文件.移动硬盘.U盘.Windows和NFS网络共享 linux是一个优秀的开放源码的操作系统,可以运行在大到巨型小到掌上型各类计算机系统上,随着 linux系统 ...
- 【NFS项目实战二】NFS共享数据的时时同步推送备份
[NFS项目实战二]NFS共享数据的时时同步推送备份 标签(空格分隔): Linux服务搭建-陈思齐 ---本教学笔记是本人学习和工作生涯中的摘记整理而成,此为初稿(尚有诸多不完善之处),为原创作品, ...
- Linux网络服务12——NFS共享服务
Linux网络服务12--NFS共享服务 一.NFS简介 端口号:TCP.UDP 111端口 NFS(Network File System)网络文件系统,是一种基于TCP/IP传输的网络文件系统协议 ...
- 在CentOS7上实现NFS共享
一.介绍 NFS 是Network File System的缩写,即网络文件系统.一种使用于分散式文件系统的协定,功能是让客户端通过网络访问不同主机上磁盘里的数据,主要用在类Unix系统上实现文件共享 ...
- NFS共享存储的使用
概述 NFS 是Network File System的缩写,即网络文件系统.一种使用于分散式文件系统的协定,由Sun公司开发,于1984年向外公布.功能是通过网络让不同的机器.不同的操作系统能够彼此 ...
随机推荐
- HDU1027 Ignatius and the Princess II
Problem Description Now our hero finds the door to the BEelzebub feng5166. He opens the door and fin ...
- [BZOJ 4720][NOIP 2016] 换教室
记得某dalao立了"联赛要是考概率期望我直播吃键盘"的$flag$然后就有了这道题233333 4720: [Noip2016]换教室 Time Limit: 20 Sec M ...
- Android文件上传与下载
文件上传与下载 文件上传 -- 服务端 以Tomcat为服务器,Android客服端访问Servlet,经Servlet处理逻辑,最终将文件上传,这里就是简单模拟该功能,就将文件上传到本机的D:\\u ...
- [补档]暑假集训D5总结
%dalao 今天又有dalao来讲课,讲的是网络流 网络流--从入门到放弃:7-29dalao讲课笔记--https://hzoi-mafia.github.io/2017/07/29/27/ ...
- swift UITapGestureRecognizer获取点击事件点击的位置point
func picTap(sender: UITapGestureRecognizer) { let point = sender.location(in: sender.view) } 其中获取的po ...
- How to create a jump server in AWS VPC
本来是写的Word文档,给其他国家的同时看的,所以一开始就是英文写的,也没打算翻译成为中文了,顺便抱怨下,网上资料找了很久的资料都没有看到介绍怎么在单机环境下搭建RD Gateway的,写本文的目的是 ...
- IntelliJ IDEA javaDoc的使用
文档注释的风格看个人主要说一下在idea中如何配置和使用快捷的文档注释 1.想像Eclipse一样使用 /**来写文档注释可以通过settings下的Live Templates来设置如下图所示 ja ...
- HTML中的target标记
HTML:target=_blank -- 在新窗口中打开链接 _parent -- 在父窗体中打开链接 _self -- 在当前窗体打开链接,此为默认值 _top -- 在当前窗体打开链接,并替换当 ...
- jQuery.ajax success 与 complete 区别
作者QQ:1095737364 QQ群:123300273 欢迎加入! 天天用,不知所以然: $.ajax({ type: "post", u ...
- GitLab Development Kit 环境搭建
在公司内网服务器上面搭建gdk环境,踩了很多坑,历时四五天(中间涉及申请开通固定外网),整理如下: 总览: 操作系统:redhat 6.3 参考文档:https://gitlab.com/gitlab ...