12

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?

2
  • 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, 2011 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 ;-) Dec 10, 2011 at 21:54

3 Answers 3

18

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.

2
  • 2
    Or maybe <VirtualHost *:80> ? Dec 2, 2011 at 13:12
  • 2
    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. Dec 10, 2011 at 21:52
4

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

3

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .