配置inotify同步脚本
#!/bin/bash
host=192.168.6.36 #另外一个wordpress
src=/usr/local/nginx/html/wordpress/
dst=wordpress
user=rsync
inotifywait=/usr/local/inotify/bin/inotifywait
rsync=/usr/bin/rsync
$inotifywait -mrq –timefmt '%d/%m/%y %H:%M' –format '%T %w%f' -e modify,delete,create,attrib $src | while read files
do
$rsync -vzrtopg –delete –progress –password-file=/etc/rsync_client.passwd $src $user@$host::$dst
echo "${files} was rsynced" >>/tmp/rsync.log 2>&1
done
2、配置前端nginx实现反向代理
vim /usr/local/nginx/conf/nginx.conf
#在http段中加入
include vhost/wordpress.conf;
mkdir /usr/local/nginx/confi/vhost
vim /usr/local/nginx/confi/vhost/wordpress.conf
upstream wordpress {
server 192.168.6.205 weight=1;
server 192.168.6.36 weight=1;
}
server {
location / {
proxy_pass http://wordpress;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
3、修改wordpress中的设置,必须将这个了的站点地址改为前端nginx的ip地址或者域名
标签:WordPress
相关阅读 >>
wordpress中给媒体文件添加分类和标签的php功能实现
wysiwyg web builder 17激活教程 附汉化步骤
深入解析wordpress中加载模板的get_template_part函数
更多相关阅读请进入《wordpress》频道 >>