拓扑环境

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

原文链接:https://www.cnblogs.com/JevonWei/p/7347941.html

centos7下利用nfs搭建wordpress的更多相关文章

  1. centos7下git服务器端搭建

    git的安装: yum 源仓库里的 Git 版本更新不及时,最新版本的 Git 是 1.8.3.1,但是官方最新版本已经到了 2.9.2.想要安装最新版本的的 Git,只能下载源码进行安装. 1. 查 ...

  2. centos7下git服务器端搭建(转)

    git的安装: yum 源仓库里的 Git 版本更新不及时,最新版本的 Git 是 1.8.3.1,但是官方最新版本已经到了 2.9.2.想要安装最新版本的的 Git,只能下载源码进行安装. 1. 查 ...

  3. 【MIT6.828】centos7下使用Qemu搭建xv6运行环境

    title:[MIT6.828]centos7下使用Qemu搭建xv6运行环境 date: "2020-05-05" [MIT6.828]centos7下搭建xv6运行环境 1. ...

  4. CentOS7下使用NFS文件共享给Window server 2012

    CentOS7下使用NFS文件共享给Window server 2012 2018年08月24日 23:15:54 疼迅扣扣 阅读数:443  出自https://blog.csdn.net/u013 ...

  5. CentOS7下利用init.d启动脚本实现tomcat开机自启动

    在之前的博文中已经对CentOS7下通过tomcat进行WEB系统的发布进行了介绍,今天将利用init.d启动脚本,将服务脚本加入到开机启动服务队列,实现tomcat服务的开机启动. 1. 环境准备 ...

  6. Linux centos7 下 svn 服务器搭建

    摘自:https://www.cnblogs.com/mymelon/p/5483215.html 鉴于在搭建时,参考网上很多资料,网上资料在有用的同时,也坑了很多人 本文的目的,也就是想让后继之人在 ...

  7. CentOS7 下安装 NFS,Linux/Windows 作为客户端

    目录 一.简介 1. 定义 2. 版本和变化 3. 部署说明 二.服务端 1. 关闭防火墙 2. 安装 nfs 3. 配置说明 4. 配置共享目录 5. 启动服务 6. 确认启动成功 三.Linux ...

  8. centos7下的nfs配置

    NFS是Network File System的缩写,即网络文件系统.客户端通过挂载的方式将NFS服务器端共享的数据目录挂载到本地目录下. nfs为什么需要RPC?因为NFS支持的功能很多,不同功能会 ...

  9. 基于centos7下appium环境搭建

    事件背景: 前几日在群里看到关总说他的server端是搭建在linux环境下,包括对客户端与服务端的交互处理,感觉整体思路清晰可鉴,于是就想尝试,动手实践,接着从环境搭建开始搞起,于是就有了这篇文章, ...

随机推荐

  1. bash arithmatic

    Arithmetic in bash is done with $ and double parentheses: echo "$(($num1+$num2))" Or $ and ...

  2. 2019杭电多校第四场hdu6623 Minimal Power of Prime

    Minimal Power of Prime 题目传送门 解题思路 先打\(N^\frac{1}{5}\)内的素数表,对于每一个n,先分解\(N^\frac{1}{5}\)范围内的素数,分解完后n变为 ...

  3. upc组队赛5 Bulbs

    Bulbs 题目描述 Greg has an m × n grid of Sweet Lightbulbs of Pure Coolness he would like to turn on. Ini ...

  4. python学习笔记:数据类型——列表/数组(list)

    Python内置的一种数据类型是列表:list.list是一种有序的集合,可以随时添加和删除其中的元素.通过下标访问列表中的元素(又称索引.角标),下标从0开始计数.list定义,使用中括号[]. l ...

  5. Java实验报告(三)&第五周课程总结

    班级 计科二班 学号 20188425 姓名 IM 完成时间2019/9/27 评分等级 实验三 String类的应用 实验目的 掌握类String类的使用: 学会使用JDK帮助文档: 实验内容 1. ...

  6. (1.3)学习笔记之mysql体系结构(C/S整体架构、内存结构、物理存储结构、逻辑结构)

    目录 1.学习笔记之mysql体系结构(C/S架构) 2.mysql整体架构 3.存储引擎 4.sql语句处理--SQL层(内存层) 5.服务器内存结构 6.mysql如何使用磁盘空间 7.mysql ...

  7. mybatis自学历程(一)

    第一个mybatis程序 IDE:myeclipse2017 jar包:mybatis3.5.2,mybatis依赖包,mysql8.0.17驱动包 注:mybatis包和所需的依赖包,可到http: ...

  8. log4j 和 log4j2 在springboot中的性能对比

    文章链接: https://pengcheng.site/2019/11/17/log4j-he-log4j2-zai-springboot-zhong-de-xing-neng-dui-bi/ 前言 ...

  9. sudo 出现unable to resolve host hostname 解决方法

    Linux 环境,我的电脑叫枝桠(机器的hostname), 每次执行sudo 就出现这个警告讯息: sudo: unable to resolve host 枝桠 直接修改 /etc/hosts 的 ...

  10. 自己写IRP,做文件操作,遇到的坑

    在写文件的时候没问题,但是写完文件之后,就出问题了, 什么问题呢,是因为写完文件之后,文件关闭之后, 调用了一个叫做 CcFlushCache 的函数,这个函数是从CcWriteBehind 调过来的 ...