Reputation: 15
I created a WordPress site in AWS EC2. it works fine and I can login to my dashboard, then I created a load balancer. I changed my SiteUrl in wp_options to my loadbalancer's dns.
I created an image of that instance. Now I created an auto-scaling group with that image. I'm able to visit my site using the load balancer dns , but I can't login into my dashboard using dns. when I type dns/site/wp-admin it says:
wp-login.php was not Found on this server
.
I don't what is the problem. kindly help me.
Upvotes: 0
Views: 817
Reputation: 6079
Edit: To why this is not working because considering you made an image of instance , that means it has two databases (assuming you have not used RDS) now and two servers with two different set of files and db. This should not be the case and might be that would be reason it is not working.
You are taking the wrong approach , you can take advantage of Auto Scaling and Load Balancing if you have designed your site in that way.
This might be a long answer but I hope it clears your understating of how it works or how ideally it should work on AWS
Stateless server
A stateless server is the pre-requisite for building a highly available and scalable infrastructure on AWS. A stateless server does not store any data expect of temporary data like caches.
By default WordPress is storing data in two different ways:
MySQL database: articles, comments, users and parts of the configuration are stored in a MySQL database.
File system: media files uploaded by the authors are stored on the file system.
If the MySQL database is running on the same EC2 instance as the WordPress application itself, the server is not stateless. Same is true for the media files stored on the file system.
Why is this a problem? Because if the virtual machine becomes unavailable, the data will be unavailable, too. And if you need to add another EC2 instance to handle more traffic all the data will be missing on the additional server
Components that you need to use are :
You can refer to this sample architecture for reference:
You can Refer this Blog Post or can use this CloudFormation Template too.
Upvotes: 1