-2

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>
4
  • Can you be a little more specific what you mean by 'resolve'? That's a term usually associated with DNS, not apache.
    – user143703
    Aug 24, 2014 at 0:04
  • Sure, I mean in the browser. Right now, when I navigate to the domains whose virtual hosts are disabled, then the browser will load the website whose virtual host is still enabled. Instead, I don't want the browser to load any website...as if there is not content to serve.
    – littleK
    Aug 24, 2014 at 0:10
  • You've probably got it set as the default. Post your config.
    – Peter
    Aug 24, 2014 at 0:15
  • I have posted my configuration.
    – littleK
    Aug 24, 2014 at 2:08

1 Answer 1

2

You can remove the A record for the website from the DNS, then browsers cannot load the web site.

Alternatively you can make a default virtual host on your web server that serves just an empty page.

Not the answer you're looking for? Browse other questions tagged .