Add the following to the /etc/sysconfig/httpd
OPTIONS="-DSLAVE"
export MASTER_SERVER="SERVICENET IP HERE"
Now you add the following to the apache configuration file
Example wordpress lsync apache configuration entry:
<IfDefine SLAVE>
RewriteEngine On
ProxyPreserveHost On
ProxyPass /wp-admin/ http://${MASTER_SERVER}/wp-admin/
ProxyPassReverse /wp-admin/ http://${MASTER_SERVER}/wp-admin/
RewriteCond %{REQUEST_METHOD} =POST
RewriteRule . http://${MASTER_SERVER}%{REQUEST_URI} [P]
</IfDefine>
Note:
You will need to make sure the proxy_http is enabled!
Sometimes lsync stops working and the error message you receive is relating to increasing inotify watches.
View Current config
cat /proc/sys/fs/inotify/max_user_watches
To calculate an estimate on the inotify values you can run the following command:
find /var/www/vhosts/ -type d | wc -l | awk '{print $1" directories needs monitoring, set [ fs.inotify.max_user_watches = " $1*3" ]"}'
To perm change the value:
echo "fs.inotify.max_user_watches=value >> /etc/sysctl.conf
sysctl -p /etc/sysctl.conf
To see what is currently being used by inotify watches you can run:
for foo in /proc/*/fd/*; do readlink -f $foo; done |grep inotify |cut -d/ -f3 |xargs -I '{}' -- ps --no-headers -o '%p %U %c' -p '{}' |uniq -c |sort -nr