Apache VirtualHost wildcards with IPv6

TommyPeanuts asked:

Using Apache 2.4 on Ubuntu, I have the following in ports.conf:

Listen XX.73.44.57:80
Listen [2001:XX:0:2c38::39]:80

<IfModule ssl_module>
         Listen XX.73.44.57:443
         Listen [2001:XX:0:2c38::39]:443
</IfModule>

<IfModule mod_gnutls.c>
         Listen XX.73.44.57:443
         Listen [2001:XX:0:2c38::39]:443
</IfModule>

I’d like to have the following in my server configs:

 <VirtualHost *:80>

but that doesn’t seem to work properly as the hosts don’t respond. I’ve also tried:

 <VirtualHost *:80 [::]:80>

The following works:

<VirtualHost [2001:XX:0:2c38::39]:80 XX.73.44.57:80>

but I’d prefer a wildcard. Do I have to give the IP addresses explicitly?

My answer:


If you want to use a wildcard address (listen on all IP addresses) in a VirtualHost, you need your Listen directive to be listening on all IP addresses.

Listen 80
Listen 443

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.