Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have Wordpress installation running on two web servers (Nginx). There is unidirectional synchronization from server A to server B and I'm using lsyncd for this purpose.

  • with his configuration I have to add blog posts from the first web server so the data is replicated to the second one - how I can force access to Wordpress back-end only from the first web server?

Please note that both servers have the same domain for Wordpress.


share|improve this question
Is there a load balancer in front of the two servers, or are they contactable directly? – EightBitTony Jun 25 '12 at 9:51
Unfortunately only RRDNS – HTF Jun 25 '12 at 10:05
have you got 2 separate DB's on both boxes? – Aceth Jun 25 '12 at 12:30
I've got Master/Slave configuration on separate servers – HTF Jun 25 '12 at 14:38
up vote 2 down vote accepted

how I can force access to Wordpress back-end only from the first web server?

It could be achieved with a two-step process...

Step 1:

On your second web server, please add the following blocks just before location / block...

location /wp-login.php {
  return 301 $scheme://ip.of.1st.server$request_uri;

location /wp-admin {
  return 301 $scheme://ip.of.1st.server$request_uri;

Step 2:

On your first web server, please add the following vhost configuration...

server {
    server_name ip.of.1st.server;
    return 301 $scheme://$request_uri;
share|improve this answer
Sign the backend link with and use it against commercial and government intelligence. – Andrew Smith Jun 26 '12 at 0:30

Assuming you are using a L7 load balancer, you could just redirect based on URI. If you are using RRDNS - then you don't really have much control.

But you could just use a shared file-system like NFS, then it wouldn't matter which machine was running the admin - as it would essentially be bidirectional.

share|improve this answer
There is only RRDNS. Unfortunately I have to stick to the current setup for now (two separate web nodes without shared storage) so is there any better solution for data replication than "lsyncd" that is bidirectional? – HTF Jun 25 '12 at 10:09
If the replication needs to be in real-time, lsyncd is the next best approach (other than NFS/Gluster). If it can be slightly delayed, the rysnc on a cron would would and could operate from each machine. What's the point in 2 servers using RRDNS - you don't have proper load balancing or any proper redundancy? – Ben Lessani - Sonassi Jun 25 '12 at 10:11
I'm using dyndns traffic management but I'm planning to use Red Hat Load balancer in the future. I think shared storage would be the best option. – HTF Jun 25 '12 at 10:21

Can you exclude files from replicating with lsyncd? You could just remove some of the files from /wp-admin/ on the 2nd host so you can't use that host to create posts, like admin.php.

Note: Untested.

share|improve this answer
WordPress can be access it only with one domain so there won't be a way to redirect clients to the admin back-end on the first node. – HTF Jun 25 '12 at 10:00

You could use domain like and you would have to use different database schema and eventually sql replication between users too. You can even do more security and copy sensitive banking data only to your backend and not the frontend.

share|improve this answer
My initial idea was to create rewrite rule on the web servers as follow: to on both web servers (with pointing to the first one) - however the problem is that WordPress can be access it only with the main domain ( and there's no way to login to the WordPress admin on each server, since they're set by domain from the database. – HTF Jun 25 '12 at 9:56
What about slightly patching the code, so it works from both? This would be the best solution from security view, so when you access backend, you dont access the same account as on the frotend. This way, you can secure filesystem on the frontend. – Andrew Smith Jun 25 '12 at 11:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.