I've got server with 1 ipv4 address and with a few ipv6 addresses. One domain is redirected to ipv4 A record I set up apache ports.conf like this:

Listen ip.v4.address:80
NameVirtualHost ip.v4.address:80

and virtualhost file:

<VirtualHost ip.v4.address:80>
DocumentRoot /var/www/first/
ServerName first.domain
ServerAlias www.first.domain
ErrorLog ...
CustomLog ...
</VirtualHost>

And everything works fine.

Now I want to create new virtualhost for second domain with second ip. I redirected second domain to ipv6 AAAA record, add to ports.conf:

Listen [ip.v6.address]:80
NameVirtualHost [ip.v6.address]:80

create new virtualhost file:

<VirtualHost [ip.v6.address]:80>
DocumentRoot /var/www/second/
ServerName second.domain
ServerAlias www.second.domain
ErrorLog ...
CustomLog ...
</VirtualHost>

and restart Apache. There was no errors on server start but it doesn't work. When I enter second domain in the browser the server is not found. When I enter [ip.v6.address] site shows up.

Any help?

link|improve this question
Thanks for help everyone. IPv6 is correct and I need two different sites. I contacted my domain provider where I set up this AAAA record. They said it can take 24h to set it up and maybe here is the problem. When I set up A record the effect was almost immediate and I thought AAAA works the same way. – sheldy Nov 18 '11 at 16:02
It would be nice if you marked your favourite answer as such, so that the people who tried to help you get some reward for doing so ;-) – Sander Steffann Dec 10 '11 at 21:54
feedback

3 Answers

Does the name resolve to the correct IPv6 address? This seems to be problem in domain resolution.

link|improve this answer
feedback

This sounds like an IPv6 name resolution error rather than an Apache error. Check that the name resolves correctly to the address.

link|improve this answer
feedback

Your apache config looks correct, but a little more complex than it needs to be if you want one site to be reachable over both IPv4 and IPv6 (dual stack).

Instead of

<VirtualHost ip.v4.address:80>
...
</VirtualHost>

<VirtualHost [ip.v6.address]:80>
...
</VirtualHost>

you can do

<VirtualHost ip.v4.address:80 [ip.v6.address]:80>
...
</VirtualHost>

That way the single virtual hosts listens on both IP addresses. It is a lot easier to maintain!

If you really want a different site on IPv6 then your configuration is correct of course.

link|improve this answer
1  
Or maybe <VirtualHost *:80> ? – Koos van den Hout Dec 2 '11 at 13:12
That could certainly work as well, but since he explicitly specified the IP addresses in his example I did so as well. If you don't really care about the IP address and just want to do everything by the Host: header then your solution is much easier. Watch out with SSL/TLS sites though. You need to make sure that Server Name Indication (TLS/SNI) works for your user base. – Sander Steffann Dec 10 '11 at 21:52
feedback

Your Answer

 
or
required, but never shown

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