拓扑环境
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