Search code examples
amazon-web-servicesamazon-ec2dnsvirtualhostelastic-load-balancer

VirtualHosts interfering with LoadBalancer


I am trying to setup a EC2 instance running AWS linux and an apache server. I am using a loadbalancer so I can use an AWS SSL certificate. My domain is at Godaddy and I pointed the nameservers to Route 53. Both my ports 80 and 443 are configured in my security group.

The files I want to serve are in a sub folder of the document root (var/www/html/landingpage/). I want my domain to point to this subfolder not the document root. I tried using Virtual Hosts in my httpd.conf:

<VirtualHost *:80>
ServerName mydomain.com
DocumentRoot /var/www/html/landingpage
</VirtualHost>

but then my load balancer health check fails. Any suggestions on how to point my Godaddy domain to this subfolder? Thank you!!


Solution

  • I see nothing wrong with that Virtualhost configuration. But are you sure the URL to check for the healthcheck is available under /var/www/html/landingpage ?

    If you configured the healthcheck to check against /, then something must be wrong on the webserver, i.e. the landingpage dir doesn't exist or doesn't contain the correct privileges.

    It's hard to say without more data. Maybe post the webserver error logs? And you ELB config?