0
votes

I'm trying to host multiple website on Amazon Ec2 linux, but it is only show the home dashboard website. I try as following virtual host configuration in httpd.conf too.

DocumentRoot "/var/www/html/SITE-1" ServerName www.myexample1.com

DocumentRoot "/var/www/html/SITE-2" ServerName www.myexample2.com

If i put like http://10.123.12.12/SITE-1 and http://10.123.12.12/SITE-2 it's getting the right page

But if i given with the DNS name the default page is only loading up, the two different site is not loading up

1

1 Answers

0
votes

It looks like your document root is still being set to /var/www/html and you may not have the proper VirtualHost containers. Try something like this:

NameVirtualHost *:80

<VirtualHost *:80>
  DocumentRoot "/var/www/html/SITE-1"
  ServerName www.myexample1.com
</VirtualHost>

<VirtualHost *:80>
  DocumentRoot "/var/www/html/SITE-2" 
  ServerName www.myexample2.com
</VirtualHost>

<Directory "/var/www/html/SITE-1">
   AllowOverride None
   Order allow,deny
   Allow from all
</Directory>

<Directory "/var/www/html/SITE-2">
   AllowOverride None
   Order allow,deny
   Allow from all
</Directory>

If you need to do SSL, you'll need to include port 443 and some other options.