Blocking non-virtual host access in Apache?

Posted by cmbrnt on Server Fault See other posts from Server Fault or by cmbrnt
Published on 2011-03-01T15:24:05Z Indexed on 2011/03/01 15:26 UTC
Read the original article Hit count: 272

Filed under:
|
|

I'm running an apache-server, with a bunch of virtual hosts for about seven domain names. Now I'd like to disallow access for clients who try to access my server using only its IP-adress. So:

  • When someone accesses my website through www.domain.com, they reach the site hosted in /var/www/domain.com/public_html/.

  • When someone enters the ip-address of the server they reach a 403 Forbidden-message.

The problem with this is that they are theoretically able to reach my other sites through bruteforce, when getting http://11.22.33.44/domain.com/public_html/.

I rather want them to reach a 403 Forbidden all the time, as long as they don't access my server by a valid domain name.

How do I solve this problem?

© Server Fault or respective owner

Related posts about apache

Related posts about debian