0

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!

2 Answers 2

3

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>
1
  • 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. Jul 25, 2009 at 21:20
0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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