简体   繁体   中英

How to login wordpress page when running behind a load balancer?

I am new to web development please bare me. I used 'WordPress Certified by Bitnami and Automattic 5.5.1-0 on Debian 10' on AWS to launch an instance.

I changed 'admin' default password and created a new image from this EC2 instance. Then I created a complete setup of auto scalling group and load balancer and used this new image in my EC2 instances.

Problem starts here:

When there is only one EC2 instance running with wordpress I am able to login with my credentials, but when there are more than one EC2 instances I am not able to login my wordpress site, I also tried it with users other than 'admin'.

Why this is happening, I changed the default password for 'admin' and then created my private AMI, so password is not an issue, I am also able to login when there is only one EC2 instance, but not when there are more than one EC2 instances.

Both the EC2 instances have there own EFS volumes, EFS is not shared, both EC2 have same images. So why problem occurs when I have more than one EC2 instances in my auto scalling group.

Is there any thing in wordpress config that I need to take care.

When using a Load Balancer, incoming traffic is distributed across multiple EC2 instances. Your login is possibly being sent to Server A, but the next page request is going to Server B, which does not recognize your login.

It might be possible to turn on "sticky sessions", which tells the Load Balancer to send requests to the same server for the same session.

See: Sticky Sessions - Elastic Load Balancing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM