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.

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

2 Answers 2

up vote 3 down vote accepted

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

<VirtualHost 111.22.33.55:8080>
ServerName www-cache.domain.tld
...
  <Directory proxy:>
  Order Deny,Allow
  Deny from all
  Allow from 111.22.33  (IP OF THE VPN CONN)
  </Directory>
</VirtualHost>
share|improve this answer
    
That did it, thanks! –  Alex Balashov Jul 25 '09 at 20:46
1  
If you want to host several hosts on the same IP address you need to add a "NameVirtualHost 111.22.33.55:8080" 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

 
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.