LAMP-----三、wordpress网站从web01复制到web02中

须要把web01里面的wordpress程序拷贝到web02中php

在web01上操做:
[root@web01 ~]# cd /application/nginx/html/
[root@web01 html]# ll
total 52
-rw-r--r-- 1 root root 537 Feb 13 10:41 50x.html
drwxr-xr-x 2 root root 4096 Feb 22 11:35 bbs
drwxr-xr-x 7 www www 4096 Feb 24 15:07 blog
-rw-r--r-- 1 root root 27435 Feb 13 14:34 gongli.jpg
-rw-r--r-- 1 root root 321 Feb 13 14:40 index.html
-rw-r--r-- 1 root root 612 Feb 13 10:41 index.html.ori
drwxr-xr-x 2 root root 4096 Feb 22 11:22 www
打包blog
[root@web01 html]# tar zcvf blog.tar.gz ./blog/
下载到windows电脑上面。
[root@web01 html]# sz -y blog.tar.gzhtml

在web02上面操做:
[root@web02 htdocs]# pwd
/application/apache/htdocs
[root@web02 htdocs]# ls
bbs blog index.html www
上传blog.tar.gz包到当前目录
[root@web02 htdocs]# rz -ynginx

[root@web02 htdocs]# tar xf blog.tar.gz
[root@web02 htdocs]# ls
bbs blog blog.tar.gz index.html www
[root@web02 htdocs]# chown -R www.www blog
浏览器打开网址:http://blog.etiantian.org/ 发现能够看到图片
LAMP-----三、wordpress网站从web01复制到web02中web

这是由于web拷贝的blog目录中有图片致使的。
[root@web02 htdocs]# cd blog/wp-content/
[root@web02 wp-content]# ls
index.php languages plugins themes upgrade uploads
[root@web02 wp-content]# cd uploads/
[root@web02 uploads]# ls
2018
[root@web02 uploads]# du -sh 2018/
320K 2018/
[root@web02 uploads]# pwd
/application/apache/htdocs/blog/wp-content/uploads
[root@web02 uploads]# mv 2018/ /tmp/
再次刷新浏览器就没有图片了。
LAMP-----三、wordpress网站从web01复制到web02中apache

设置挂载
[root@web02 uploads]# rpm -qa rpcbind nfs-utils
[root@web02 uploads]# yum install -y rpcbind nfs-utils
[root@web02 uploads]# rpm -qa rpcbind nfs-utils
rpcbind-0.2.0-13.el6_9.1.x86_64
nfs-utils-1.2.3-75.el6_9.x86_64
[root@web02 uploads]# /etc/init.d/rpcbind start
Starting rpcbind: [ OK ]
[root@web02 uploads]# chkconfig rpcbind on
[root@web02 uploads]# showmount -e 172.16.1.31
Export list for 172.16.1.31:
/data 172.16.1.0/24
[root@web02 uploads]# mount -t nfs 172.16.1.31:/data/nfs-blog /application/apache/htdocs/blog/wp-content/uploads/
这里的设置开机自动挂载最好是全路径:
[root@web02 uploads]# which mount
/bin/mount
[root@web02 uploads]# echo "/bin/mount -t nfs 172.16.1.31:/data/nfs-blog /application/apache/htdocs/blog/wp-content/uploads/" >>/etc/rc.local
[root@web02 uploads]# tail -3 /etc/rc.local
再次刷新网址http://blog.etiantian.org/ ,图片刷新过来了,说明ok了。以下图所示ok了。
LAMP-----三、wordpress网站从web01复制到web02中windows