I'm trying to set up dynamic VirtualHosts subdomains using Apache 2.4 on Windows 8.1 with Acrylic DNS Proxy, but I'm running in to problems with Server Not Found errors. I've read so many answers already, like this one, but I can't figure out what's wrong or how to fix it.
My aim is to set up a local domain (http://localhost.pc
) to serve all subdomains dynamically from folders in /htdocs
, so http://test.localhost.pc/
from /htdocs/test/
etc. My VirtualHost config is set up as
<VirtualHost *:80>
UseCanonicalName Off
ServerName localhost.pc
ServerAlias localhost.pc www.localhost.pc
DocumentRoot C:/dev/apache/htdocs/
<Directory />
Options FollowSymLinks Includes ExecCGI Indexes
IndexOptions FancyIndexing HTMLTable FoldersFirst
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
UseCanonicalName Off
ServerName localhost.pc
ServerAlias *.localhost.pc
VirtualDocumentRoot C:/dev/apache/htdocs/%1/
<Directory />
Options FollowSymLinks Includes ExecCGI
IndexOptions FancyIndexing HTMLTable FoldersFirst
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I've installed Acrylic DNS Proxy, I've changed the IPv4 DNS server to 127.0.0.1 for my WiFi and my (disconnected) Ethernet, and I've edited AcrylicHosts.txt to include the line
127.0.0.1 localhost.pc *.localhost.pc
Acrylic seems to work fine, I've enabled the debug log and hit log and regular internet browsing works fine. However, if I visit my local domain or subdomains I get the server not found error despite Acrylic's debug log saying
TResolver.Execute: Request ID 34019 received from client 127.0.0.1:55587 [Q=localhost.pc;T=AAAA;Z=84E301000001000000000000096C6F63616C686F737403706D6100001C0001].
TResolver.Execute: Response ID 34019 sent to client 127.0.0.1:55587 directly from hosts cache.
And the hit log saying
127.0.0.1 H Q=localhost.pc;T=A
127.0.0.1 H Q=localhost.pc;T=AAAA
Pinging localhost.pc from the command line fails (could not find host), but nslookup looks right
C:\>nslookup localhost.pc
Server: UnKnown
Address: 127.0.0.1
Name: localhost.pc
Addresses: 127.0.0.1
127.0.0.1
If I then add 127.0.0.1 localhost.pc
to C:\Windows\System32\drivers\etc\hosts
and flush the DNS cache, I can at least get http://localhost.pc/
to load. The whole point of Acrylic is being able to use wildcards, but http://test.localhost.pc
only works if I manually add it, and any other subdomain/folder, to the Windows hosts file.
So I'm guessing Acrylic is the problem if adding entries to the Windows hosts file manually gets things working. Does anyone have any ideas what is going wrong and how to fix it?
I've fixed a bug regarding AAAA queries not resolved properly from the AcrylicHosts.txt file in versions <= 0.9.27.
If you use the latest (0.9.28) version you should be fine.