Access to apache virtual hosts and document root on EC2

amazon ec2apache-2.2virtualhost

I've set up a new VirtualHost on Apache with this configuration:

DocumentRoot "/var/www/html"

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

When I access to mydomain.net I get the correct document root. But If I go to http://myIP it access to /var/www/html/mydomain.net instead of /var/www/html

Any idea how to fix this ?

Thanks!

Best Answer

You need to set up a default virtualhost to catch unspecified requests, otherwise the mydomain.net one will catch those.

Here's the Apache documentation on this topic:

http://httpd.apache.org/docs/2.2/vhosts/examples.html#default

Related Topic