Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

In Apache2, is it possible to bind a VirtualHost to a different IP interface than other virtual hosts, or the server's default Listen address?

The goal is to have a web server that serves some public sites serve some Intranet sites over a VPN interface as well.

I suppose another approach would be to make an .htaccess file that requires passwords from everyone except VPN source addresses, but I would really prefer to be extra careful on that and just not make the sites publicly accessible in the first place.

Thank you very much in advance!

share|improve this question
up vote 3 down vote accepted

Why not try like this (if you have access to the apache2 conf file,do you?)

ServerName www-cache.domain.tld
  <Directory proxy:>
  Order Deny,Allow
  Deny from all
  Allow from 111.22.33  (IP OF THE VPN CONN)
share|improve this answer
That did it, thanks! – Alex Balashov Jul 25 '09 at 20:46
If you want to host several hosts on the same IP address you need to add a "NameVirtualHost" line too. It needs to match the value in your VirtualHost line. – David Pashley Jul 25 '09 at 21:20

You have to be Listening on all the interfaces and ports that all of your vhosts are going to be visible on. Then the address portion of the VirtualHost limits to which address serves out which site. Named based vhosts are even better for security, as the server name in the URL will further enforce which content comes out of which address.

share|improve this answer

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.