Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

If I ask Apache for domain.com that has no Virtual Host setup in Apache configuration, Apache will show the default Virtual Host. How can I prevent this from happening or simply drop the connection?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

Use a default virtual host configured to give the response you want in that situation.

Careful what you put there. I've seen clients get upset that we 'stole their domain' when the web host logo came up during some delegation issues =)

share|improve this answer
add comment

This is expected behavior - if you have Apache serving on an IP that a domain resolves to but don't have that domain set up as a virtual host, you get the default virtual host. That's just how it works.

share|improve this answer
    
Thank you but is this OK for a nameserver to open Apache default virtualhost? –  Zim3r Dec 14 '12 at 19:44
add comment
Listen 80
NameVirtualHost *

<VirtualHost _default_:80>
    RewriteEngine On
    RewriteRule . - [G]
</VirtualHost>

This will send an HTTP 410 "Gone".

You can't prevent it from happening. Apache still needs to listen on that port and it has to do something with that connection.

share|improve this answer
    
Thanks, It doesn't work. –  Zim3r Dec 15 '12 at 19:43
    
It should. What errors are you seeing? –  ablackhat Dec 15 '12 at 20:37
    
It just normally loads the page. Thanks again. –  Zim3r Dec 16 '12 at 8:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.