I tried to create a WordPress application with a 2 tier architecture on Google Compute Engine. Created an instance in which the WordPress Web and App servers are installed and configured it with the database credentials installed in another instance with the IP.
Created an image out of this instance’s disk and used it to create an Instance Template. Using the Instance Template created an Instance Group with AutoScaling – ON and based on HTTPLoadBalacing usage – 80%, Minimum number of instances 1, Maximum number of instances 3 and cooling period 15 seconds.
Created a HTTPLoadBalacing with a Forwarding Rule and obtained an IP. Created a backend service with the health check on port 80. Added the Instance Group to the backend service. This complete setup works fine but when the links on the WordPress web page, the application is redirected with the IP of the initial instance out of which we have created the image.
As a workaround we tried to create the image by configuring the HTTPLoadBalacing IP as Home and SiteURL in the WordPress Config file. But this is failing the health check and the instances are treated as unhealthy instances even though the Apache is running on the instances.
Could someone help me on this?
Most likely, you have not defined the FQDN and your options in WP still point to the specific instance of WP (by IP).
This is working fine now. The problem is with the Path in the Health Check.
I previously installed the wordpress on DB and configured the image to LoadBalancer. So the health check path with “/” passed.
But now I haven’t installed the wordpress on DB so the health check has to be done on the path “/wp-admin/install.php”.
After the change in the health check path this is working fine. I used the LoadBalancer IP as the Home and SiteURL in the wp-config.php file. Now all the links are working fine and navigating properly.