Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

Like many of us, I have an apache server (2.2.15, plus patches) with a lot of virtual hosts on it. More than I have IPv4 addresses, to be sure, which is why I use NameVirtualHost to run lots of them on the same IPv4 address.

I'm busily trying to get everything I do IPv6-enabled. This server now has a routed /64, which gives me an awful lot of v6 addresses to throw around. What I'm trying to find is a simple way to tell each v4-NameVirtualHost that it should also function as a VirtualHost on a unique ipv6 address. I really, really don't want to have to define each virtual host twice.

Does anyone know of an elegant way to do this? Or to do something comparable, in case I've embedded any dangerously-ignorant assumptions in my question?

share|improve this question
up vote 5 down vote accepted

I think something like this will work (disclaimer: this is from the top of my head, I haven't tested this yet):


<VirtualHost [2001:db8::1]:80>
   ServerName blabla

<VirtualHost [2001:db8::2]:80>
   ServerName blabla2

share|improve this answer
The docs indicate that this should work fine... – Michael Hampton Nov 7 '12 at 23:38
Sander, thank you! I shall test this, and if it works, I shall accept this answer. – MadHatter Nov 8 '12 at 7:55

The easy way is to do nothing to your Apache configuration.

Assuming you used directives like NameVirtualHost * and <VirtualHost *:80> then Apache will answer for any of the virtual hosts on any address it's Listening on (all possible addresses, by default).

If you don't find it acceptable for Apache to answer any virtual host on any possible IPv6 address, then you'll end up having to edit your <VirtualHost> entries as shown in @SanderSteffann's answer.

share|improve this answer
Notwithstanding my comment to Sander above, I would accept this answer also, if I could. Your point is excellent, and shows me how my mind has got trapped in "the old days" of Apache config. I will think hard about whether I need to implement Sander's idea at all before I roll it out into production. Thank you! – MadHatter Nov 8 '12 at 7:56

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.