how to host multiple wordpress website with different port as container inside EC2

Viewed 92

I'm trying to host multiple small wordpress websites with different ports (81, 82 and 83) by using docker inside EC2. Problem is when I'm trying to map those ports in AWS ALB and ALB successfully forward to each instance and wordpress but wordpress redirect to its siteURL with each ports mapping as follow:

https://my-alb-00000000.ap-southeast-1.elb.amazonaws.com:81 https://my-alb-00000000.ap-southeast-1.elb.amazonaws.com:82 https://my-alb-00000000.ap-southeast-1.elb.amazonaws.com:83

So, I want to know how to fix that issue? Could I install nginx to make port mapping or anyway to prevent wordpress siteURL mapping configuration?

1 Answers

I've found a solution that we can create different wordpress docker containers with different ports, then mapped those ports to AWS ALB with different target groups or within same target group. The main key is we need to update subdomain or full domain in wordpress's siteURL. Thus whenever we want to access wordpress or its admin, we cannot browser with each IP and Port anymore. We can access with its subdomain or its full domain.

Related