Background:
Goal: www.domain123.com always goes -> https://www.domain123.com
If a user types in domain123.com (without www) it should also go to https://www.domain123.com
Current set up - Route53:
Application load balancer set up - Listeners:
Target Group -
Conf file - <VirtualHost *:80> ServerAdmin [email protected] DocumentRoot "/var/www/html/domain123.com" ServerName domain123.com #ServerAlias domain123.com ErrorLog "logs/domain123.com-error_log" CustomLog "logs/domain123.com-access_log" common
Thanks in advance.
For your first question as you're using Route 53 its better to use an Alias record (via the A record type), this will resolve your hostname directly to the IP addresses of he load balancer. Ensure you have a record for each domain that needs to resolve to the load balancer.
For your second question, you don't need to use a CNAME
you can use an Alias record to resolve either directly to the load balancer or another Route 53 record that you have access to.
For your third question you don't need a listener on port 80, but you must if you want to do a HTTP to HTTPS redirect. As its target you can actually add a redirect action to have it redirect to HTTPS, therefor
For your fourth question if the hostname is not matched in another Vhost the first VirtualHost will serve the traffic.
If you want to always go to www.example.com
you should do the following in your ALB.
www.example.com
with the path appended.www.example.com
, then for the default actions have it redirect to the www.example.com
domain as it is not on it.Take a look at these links: