拓扑环境

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. java获取字符串编码和转换字符串编码

    public class EncodingUtil { // 这里可以提供更多地编码格式,另外由于部分编码格式是一致的所以会返回 第一个匹配的编码格式 GBK 和 GB2312 public stat ...

  2. C++ STL rope 可持久化平衡树 (可持久化数组)

    官方文档好像 GG 了. rope 不属于标准 STL,属于扩展 STL,来自 pb_ds 库 (Policy-Based Data Structures). 基本操作: #include <e ...

  3. 20140923 cin.get() getline cin

    #include<iostream> #include<string> using namespace std; int main() {     string title; ...

  4. shell编程:find命令

    写在前面 在linux的日常管理中,find的使用频率很高,熟练掌握对提高工作效率很有帮助. find的语法比较简单,常用参数的就那么几个,比如-name.-type.-ctime等.初学的同学直接看 ...

  5. shell编程:字符串处理方式

    字符串处理方式 计算字符串长度 获取子串在字符串中的索引位置 计算子串长度 抽取(截取)字串 1.计算字符串长度,有两种方式 $ ${#string} $ expr length "$str ...

  6. 循序渐进学.Net Core Web Api开发系列【13】:中间件(Middleware)【有源码】

    原文:循序渐进学.Net Core Web Api开发系列[13]:中间件(Middleware) 系列目录 循序渐进学.Net Core Web Api开发系列目录 本系列涉及到的源码下载地址:ht ...

  7. spring纯注解的account案例

    dao层: package cn.mepu.dao.imp; import cn.mepu.dao.IAccountDao; import cn.mepu.domain.Account; import ...

  8. react 小技巧

    1.当从redux里异步获取数据时,在render里渲染dom会出现数据还未获取到的情况,这时可以用 usableSchemas.data.vertexes && usableSche ...

  9. 2018-8-10-win10-uwp-ApplicationView

    title author date CreateTime categories win10 uwp ApplicationView lindexi 2018-08-10 19:16:53 +0800 ...

  10. JDK安装的一些设置

    一:设置环境变量 1.新建环境变量JAVA_HOME值为JDK安装目录   然后编辑Path环境变量添加".%JAVA_HOME%\bin;". Ps:JDK5.0不需要设置cla ...