0

I have an Amazon ec2 m3 medium instance running AMI(RedHat based) Linux.

I am trying to host multiple domains on this instance by adding this at the end of httpd.conf:

<VirtualHost *:80>
        ServerAdmin [email protected]
        DocumentRoot /var/www/html/domain1
        ServerName domain1.com
        ErrorLog logs/domain1.com_error_log
        CustomLog logs/domain1.com_access_log common
</VirtualHost>
<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/html/
    ServerName domain2.com
    ErrorLog logs/domain2.com-error_log
    CustomLog logs/domain2.com-access_log common
</VirtualHost>

Now here is my problem:

When I open domain1.com it opens just fine, but when I open the IP of server in the browser domain1.com opens.

Contents of domain1.com are stored in 192.168.1.1/domain1/ OR /var/www/html/domain1

The directory /var/www/html is supposed host domain2.com in future.

So when I open the IP, the contents of /var/www/html/ should be displayed. Instead, I see the Wordpress installation of /var/www/html/domain1/ I have also tried deleting the .htaccess file from each of the two directories.

1 Answer 1

1

It looks like your first virtual host points to the domain1 directory. Loading the IP, with those two virtual hosts in that order, would load the domain1 directory. To change that you can just swap the order they are listed in.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .