WordPress multisite behind an AWS load balancer

I’ve set up a multisite WordPress installation and would like to move it to 2 EC2 instances behind a load balancer. My issue is with the wp-config.php configuration setting for the DOMAIN_CURRENT_SITE parameter. I currently have it set as follows

define(‘DOMAIN_CURRENT_SITE’, ‘ec2-instance-1.us-west-2.compute.amazonaws.com’);

Read More

How should this be set if I am load balancing between multiple EC2 instances? Because it’s multisite the DOMAIN_CURRENT_SITE value is saved in the WP database. I am unsure how this should be set since I am sharing a single RDS db between multiple WordPress instances. If I set it to one of the EC2 host names then the others would generate an error when connecting to the db. I’ve tried setting it to the load balancer domain name (and have updated the domain name in the db) but I’m getting a blank white page and the load balancer shows the EC2 instances as ‘Out of Service’. I’d appreciate any help anyone can offer.

Thanks

Related posts

2 comments

  1. Make a DNS CNAME record for the ELB’s hostname. Then use the CNAME’s hostname as the DOMAIN_CURRENT_SITE.

  2. Just an update – it turned out the issue was caused by not including the correct IP addresses in the security group for the EC2 instances and the load balancer. Once I added the addresses to each security group the ELB was able to direct traffic to the instances without a problem.

Comments are closed.