2

I have two domains on the same instance.

I've already configured the httpd.conf as follow:

<VirtualHost *:80>
ServerAdmin webmaster@dropcash.com.br
ServerName dropcash.com.br
DocumentRoot "/var/www/html/dropcash.com.br"
ErrorLog "logs/dropcash.com.br-error_log"
CustomLog "logs/dropcash.com.br-access_log" common
</VirtualHost>

<VirtualHost *:80>
ServerName descontos.top
ServerAdmin webmaster@descontos.top
DocumentRoot "/var/www/html/descontos.top"
ErrorLog "logs/descontos.top-error_log"
CustomLog "logs/descontos.top-access_log" common
</VirtualHost>

The configuration on Route 53 is:

First domain

NAME -- Type - Value

dropcash.com.br -- A - ip(elastic ip ec2)

dropcash.com.br -- NS - Values

dropcash.com.br -- SOA - VALUES

www.dropcash.com.br -- A - sameip(elastic ip ec2)

Second domain

NAME -- Type - Value

descontos.top -- A - sameip(elastic ip ec2)

descontos.top -- NS - Values

descontos.top -- SOA - VALUES

www.descontos.top -- A - sameip(elastic ip ec2)

When I try to access the descontos.top, it works. However when I put www.descontos.top, it goes to dropcash.com.br

Why is that happening? How can I fix it?

Thanks a lot!

1 Answers1

3

You are missing the proper hostname in your descontos.top part of the httpd.conf. All you have is

ServerName descontos.top

and if you are trying to reach www.descontos.top you neet to explicitly add it also:

ServerName descontos.top
ServerAlias www.descontos.top

or just

ServerName www.descontos.top

Untill you add it, if httpd receives a request with unknown Host: header, it will serve the first VirtualHost, and in your case it is dropcash.com.br (which is why www.dropcash.com.br works fine, but you should add that also as ServerAlias, to make sure it doesn't break in the future when you change httpd.conf)

Dusan Bajic
  • 10,249
  • 3
  • 33
  • 43