拓扑环境

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. ubuntu 开机启动shell脚本

    1.创建shell启动脚本test 2.将启动脚本复制到 /etc/init.d 目录下 3.设置脚本文件权限 sudo chmod 755 /etc/init.d/test 4.设置脚本启动 sud ...

  2. toString()方法,与call()方法结合;用来进行数据类型检测

    ​ //toString()方法,与call()方法结合;用来进行数据类型检测 console.log(Object.prototype.toString.call([]));//'[object A ...

  3. Java web后台插入数据库中文乱码问题解决

    前言:项目想要避免乱码情况的出现,要保持服务器.数据库.项目.以及前端编码一致.一.项目以及前端编码,设置. myeclipse--->右键项目--->Properties--->R ...

  4. Money

    /** * www.yiji.com Inc. * Copyright (c) 2012 All Rights Reserved. */package com.yjf.common.lang.util ...

  5. Eureka 系列(04)客户端源码分析

    Eureka 系列(04)客户端源码分析 [TOC] 0. Spring Cloud 系列目录 - Eureka 篇 在上一篇 Eureka 系列(01)最简使用姿态 中对 Eureka 的简单用法做 ...

  6. 在不打开excel的情况下用python执行excel

    import win32com.client import time path = r'absolute dir' #比如填文件的绝对路径,比如d:/file/stock.xlsx xl = win3 ...

  7. MySQL-技术专区-数据库权限管理

    前言 学习mysql数据库,对于它的权限的管理是关键的一环.所以,下面介绍的是MySQL权限的管理. MySQL权限表 MySQL数据库实际上是通过将用户写入mysql库中对应的权限表来控制访问权限的 ...

  8. Spring学习笔记(7)——Bean的基本配置

            先从IOC说起,这个概念其实是从我们平常new一个对象的对立面来说的,我们平常使用对象的时候,一般都是直接使用关键字类new一个对象,那这样有什么坏处呢?其实很显然的,使用new那么就 ...

  9. AJAX 向后台发送带 List 集合的对象(转)

    var school = {};school.name = '清华大学';school.address = "北京";//此处使用的是 easyui 插件来获取数据var rows ...

  10. shell专用参数变量