DNS AAAA record setup – server pingable but website not working

eastclintw00d asked:

I registered a domain at one.com and I’ve set up an AAAA entry (test.example.com) pointing to my raspberry pi server running ubuntu and apache2 (with default config on port 80) behind my home router. I have unblocked ports 80 and 443.

When I use an external ping site like http://www.ipv6now.com.au/ I get working pings over IPv6. Also, my ISP is using DSlite so I should be fully capable of using IPv6. However, I am an amateur on this topic.

When I point my browser to http://test.example.com I would expect to see the standard apache test site which I get when using the internal IPv4 or IPv6 of my raspberry. But what I get is only the German equivalent of

Page not found.

What am I missing?

This is my apache config:

<VirtualHost *:80>

        ServerAdmin [email protected]
        DocumentRoot /var/www/html
        ServerName test.example.com

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined

My answer:

Never put a hostname in <VirtualHost>.

The reason why is that Apache resolves the hostname at startup, and never sees any changes made to it later. Apache themselves recommend against doing this for that reason.

Hostnames can be used in place of IP addresses in a virtual host definition, but they are resolved at startup and if any name resolutions fail, those virtual host definitions are ignored. This is, therefore, not recommended.

There are few if any circumstances where it should be set to anything other than *, e.g.:

<VirtualHost *:80>

View the full question and any other answers on Server Fault.

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