Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have to close access to website by ip (close access via, but access via domain should be still available.

I've read (section Using Name-based Virtual Hosts), configured as recommended:

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot /www/domain

restarted httpd, but this VirtualHost is still available by ip.

What am I doing wrong?

share|improve this question
Changed IP address to one within an RFC 3330 TEST-NET example range. – Skyhawk Apr 19 '12 at 20:41
up vote 5 down vote accepted

Your apache will always use the first virtualhost as the default one.

So before any other vhosts, create another one that points to whichever you want to show all visitors hitting a hostname that doesn't exist within a virtualhost config.

share|improve this answer
Thank you! I've added VirtualHost with <VirtualHost *:80> DocumentRoot "/home/blogs/" <Directory "/home/blogs/"> Order Deny,Allow Deny from all </Directory> </VirtualHost> – Kirzilla Apr 19 '12 at 20:35

Your Answer


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.