4

Currently I have the "ports.conf" with the following content:

NameVirtualHost *:80
Listen 80

<IfModule mod_ssl.c>
    Listen 443
    NameVirtualHost *:443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

So to add IPv6 I have to change it to:

NameVirtualHost 91.64.99.215:80
Listen 91.64.99.215:80

NameVirtualHost [2a01:4f8:140:54e4::3]:80
Listen [2a01:4f8:140:54e4::3]:80

<IfModule mod_ssl.c>
    Listen 443
    NameVirtualHost 91.64.99.215:443
    NameVirtualHost [2a01:4f8:140:54e4::3]:443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 91.64.99.215:443
    Listen [2a01:4f8:140:54e4::3]:443
</IfModule>

Is this correct?

My fear is that if I do this all vhosts set up like

<VirtualHost *:80>
     ServerName www.domain.tld
     ServerAlias domain.tld
     DocumentRoot /www/domain
</VirtualHost>

will go berserk. If this is not the case, doing

<VirtualHost *:80 [*]:80>
     ServerName www.domain.tld
     ServerAlias domain.tld
     DocumentRoot /www/domain
</VirtualHost>

should also make the domain available via IPv6?

I am a bit confused here and cannot make much out of the existing "examples" Any help will be appreciated.

kghbln
  • 371
  • 1
  • 9
  • 19
  • This looks fine. What is the problem you are having with it? – Michael Hampton Aug 26 '14 at 17:48
  • There are several contradictory stetup examples out there. I just want to make sure that if I change "ports.conf" as described, that all the vhosts set up like ```text ServerName www.domain.tld ServerAlias domain.tld DocumentRoot /www/domain ``` will still work like nothing was change at "ports.conf". – kghbln Aug 26 '14 at 18:11
  • Why wouldn't they? What happened when you tested this? – Michael Hampton Aug 26 '14 at 18:14
  • I am utterly sorry. Having problems to add a comment with serveral lines and code blocks :( I did not test so far, since there are active websites running. I am just worried that the * is to unspecific. I will give it a try now. – kghbln Aug 26 '14 at 18:15
  • I get the following warning ```[warn] _default_ VirtualHost overlap on port 443, the first has precedence``` ```[warn] NameVirtualHost 91.212.95.130:80 has no VirtualHosts``` I believe that as soon as I activate this everything goes down the sink. Obviously it has not VirtualHosts because they are all set up like `````` – kghbln Aug 26 '14 at 18:23
  • I am just worried that I will have to reconfigure all vhosts to `````` before changing the "ports.conf". This appears to be a pretty inelegant solution. So basically the question is: Is there a configuration for "ports.conf" that avoids this? – kghbln Aug 26 '14 at 18:33

1 Answers1

17

You just need to change your Listen directives to:

Listen [::]:80
Listen [::]:443

while your

NameVirtualHost *:80
<VirtualHost *:80>

remain the same.

Note: netstat -tln will show apache listening only on tcp6 / :::80; that is normal (it will also respond to IPv4 as before)

Matija Nalis
  • 2,409
  • 23
  • 37