Domain name is bringing up wrong site

Posted by daniel0mullins on Server Fault See other posts from Server Fault or by daniel0mullins
Published on 2014-06-03T20:44:24Z Indexed on 2014/06/03 21:27 UTC
Read the original article Hit count: 118

Filed under:
|
|

I have a VPS that hosts several domains. I have set up Apache in the following manner:

First VirtualHost

/etc/apache2/sites-available/somedomain.com

<VirtualHost somedomain.com:80>
    ServerName somedomain.com
    ServerAlias www.somedomain.com
    ...
</VirtualHost>

Second VirtualHost

/etc/apache2/sites-available/someotherdomain.com

<VirtualHost someotherdomain.com:80>
    ServerName someotherdomain.com
    ServerAlias www.someotherdomain.com
    ...
</VirtualHost>

Then I symlink the config files from sites-available to sites-enabled and all is well.

I had a need to 'turn off' someotherdomain.com, so I removed the symlink to /etc/apache2/sites-available/someotherdomain.com from sites-enabled and the site no longer shows up... BUT typing someotherdomain.com into a web browser brings up somedomain.com!!! I need it to not resolve at all.

Does somethiing need to be done in the VirtualHost to just automatically return a 500 or something along those lines. I really don't want people to reach one website from a different domain.

Thanks!

EDIT

ports.conf looks like this

NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
    NameVirtualHost *:443
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

© Server Fault or respective owner

Related posts about apache-2.2

Related posts about webserver