Apache disabled virtual host domains resolve an enabled virtual host

Posted by littleK on Server Fault See other posts from Server Fault or by littleK
Published on 2014-08-24T00:01:43Z Indexed on 2014/08/24 4:22 UTC
Read the original article Hit count: 442

Filed under:

I have three virtual hosts defined on apache on my Ubuntu server for three different domains. If I disable two of the virtual hosts (a2dissite) and try to resolve those two URL's in the browser, then the one remaining enabled site will resolve.

How can I configure apache so that the domains for the disabled virtual hosts do not resolve?

This is how all 3 virtual hosts are configured (info is masked):

# domain: myfirstdomain.com
# public: /home/me/public/myfirstdomain.com/

<VirtualHost *:80>
  # Admin email, Server Name (domain name), and any aliases
  ServerAdmin [email protected]
  ServerName  www.myfirstdomain.com
  ServerAlias myfirstdomain.com

  # Index file and Document Root (where the public files are located)
  DirectoryIndex index.html index.php
  DocumentRoot /home/me/public/myfirstdomain.com/public

  # Log file locations
  LogLevel warn
  ErrorLog  /home/me/public/myfirstdomain.com/log/error.log
  CustomLog /home/me/public/myfirstdomain.com/log/access.log combined
</VirtualHost>

© Server Fault or respective owner

Related posts about apache-2.2