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@gmail.com
        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@gmail.com
    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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.