Configuration of the internal DNS-Server
The newest versions of WWebserver comes with a buildin unauthorized DNS-Server which allows forwarding and caching.
A Virtual Host tells the web server the home directory of a domain.
However, the domain must be resolvable via DNS so that your web browser can find the IP address of the domain, which must be the IP on which the web server is running.
You can use the integrated DNS-Server easily to setup virtual domains on your system.
1. Open C:\WWebserver\cfg\dns.txt
and enable the DNS-Server.
# DNS-Server is enabled (true) or disabled (false)
enableDNSServer=true
# Let dnsServerIP empty to use the default HTTP host defined in init.txt
# On WWebserver with PHP 7+ you should use a IPV6 address like ::1 for localhost.
# Keep care that IPV6 is available on your system.
dnsServerIP=127.0.0.1
# DNS queries which cannot be resolved in dnsrecord.txt will be forwarded
# to another name server you can define here.
# Let empty to use the default DHCP name server of your system.
# Or for example 8.8.8.8 for Google name server.
# Or false for no forwarding.
dnsForwardTo=
# DNS cache is enabled (true) or disabled (false)
# To clear the DNS cache you have to exit and restart WWebserver.
enableDNSCache=true
2. Open C:\WWebserver\cfg\dnsrecord.txt
and edit your DNS records. Allowed record types are A, PTR, MX, TXT and CNAME.
Note! No SOA records are allowed.
; A dot will use the DNS suffix of your system. Or type in domain name like: mydomain.com.
$ORIGIN .
; PTR Records
1.0.0.127.in-addr.arpa. IN PTR localhost
; A Records
; For example we define a second localhost
localhost2 IN A 127.0.0.1
You dont have to restart WWebserver after changing this file (Update time is 10 seconds).
For errors look at log/error.log
Take also a look at vhost.txt to register virtual hosts in WWebserver with own directories and PHP versions.
3. Insert the DNS-Server IP as the preferred name server into your network adapter settings.
On WWebserver with PHP 7+ you should use a IPV6 address because Win7, Win10+ will prefer IPV6 DNS.
If you want to use a IPV4 address on Win7, Win10+ you have to disable the IPV6 network adapter.
More informations how to change DNS settings on Windows 10 you will get HERE.