skip to Main Content

I have two servers with apache , each server has the same WordPress installed . and I have another server with the database engine.. Both WordPress are connected to the same DB… But obviously the DB has only 1 domain set up… So only one WordPress is responding the other one just exists… Does anyone know how to switch dynamically the WordPress in case the server 1 fails… Someone has done this before? The problem is that I don’t know how to balance both WP if only one is always responding.

2

Answers


  1. I am not sure what you want to achieve here. the scenario you ask is like how to set up a load balancer. if you seek something like setting up a load balancer here is a sample article on how to get it done with AWS. otherwise, you may need your servers configured.
    But It is possible to set the site URL manually in the wp-config.php file.so you can try to add these two lines to your wp-config.php, where “example1.com” is the correct location of your site.

    define( 'WP_HOME', 'http://example1.com' );
    define( 'WP_SITEURL', 'http://example1.com' );
    

    and in the second server add the other URL(ex:http://example2.com) in there wp-config.php. But when you add images, make sure you use relative URLs.but I can’t guarantee this since it may break your site links.

    Login or Signup to reply.
  2. I would put both of your wordpress servers in a Loadbalancer, that way traffic can get routed to both WordPress servers. And in the case that one of the server goes down, the Loadbalancer would be able to start routing traffic to the WordPress server that is still up.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search