1

The Apache Virtual Host documentation says :

You can alternatively specify an explicit IP address in place of the * in <VirtualHost *:80> directives. For example, you might want to do this in order to run some name-based virtual hosts on one IP address, and either IP-based, or another set of name-based virtual hosts on another address.

These virtual host blocks get executed on a server which obviously has 1 IP address. Why would there be a necessity to mention different IP address in these VirtualHost directives?

Thanks

  • Seems that the answer is in the question, regarding the doc extract you provided. If your server has multiple IP addresses, then you can bind a specific vhost name on a dedicated IP (eg : www.test.com on 192.168.1.10 and www.example.com on 192.168.1.11) – krisFR Jan 11 '15 at 7:34
  • @krisFR, Cool so servers can be assigned multiple IPs. Newbie in server stuff, didn't know about that. Thanks! – serpent403 Jan 11 '15 at 7:42
2

These virtual host blocks get executed on a server which obviously has 1 IP address.

Servers don't obviously have a single IP address.

A machine (any machine, not only server hardware) may have multiple physical network cards, and therefore multiple IP addresses. An operating system may also use multiple virtual network interfaces and thus have multiple IP addresses. The ability to use a specific IP address is not only not-strange, it's very much desirable.

  • +1 from me. My colo box, for example, has four ipv4 addresses. One hosts a single dedicated website, one hosts all the other sites using name-based virtual hosting, and the other two don't have any web-related activity. – MadHatter Jan 11 '15 at 12:36

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.