0

I'm trying to get VirtualDocumentRoot to work in a fresh install of apache2 on Ubuntu Server.

I've got httpd.conf configured as such:

<VirtualHost *:80>
    ServerName thicket
    DocumentRoot /var/www
    UseCanonicalName Off
    VirtualDocumentRoot /var/www/%1/%2
</VirtualHost>

When I restart apache, I can't access dev.test.thicket/index.html even though the associated file/directory exists (/var/www/dev/test/index.html).

When I comment out UseCanonicalName and VirtualDocumentRoot, I can access the server by using thicket/dev/test/index.html

Apache confuses and frightens me. What am I doing wrong here?

0

Is your DNS resolving "dev.test.thicket" to either localhost (127.0.0.1 or ::1) if you are issuing the request locally, or whatever the server's IP is if you are issuing the request remotely?

VirtualHosts make serving decisions based on the incoming "Host:" header of the HTTP request, but DNS is doing separate resolving before that HTTP request even gets sent.

If your system's hostname is "thicket", just that word might be resolving to 127.0.0.1 via the /etc/hosts file, especially if you set that hostname as part of the operating system installation.

You could try to add "dev.test.thicket 127.0.0.1" to your hosts file just for testing purposes.

  • I can ping 'thicket' from a box on the same network, but 'dev.thicket' cannot be found. This is a DNS issue then? – Jim Greenleaf Nov 8 '10 at 23:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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