Menu Share

Share your XAMPP or WAMP server over network, DNS trickery

How to make your XAMPP server available on all devices on your Network

When you are developing a website, you want to know how the website behaves on different devices. XAMPP runs on your local machine, and probably can be reached bij typing in the ip address of your local machine. However, if you use named virtual hosts, you have to add those hosts to the DNS hosts file of each and every device, and this can be difficult.

If you have a router where you can add DNS entries, usually with DNSMasq, you can use that.

But...

But there is a simpeler way, if you have access to a normal "on the internet" website where you can edit the DNS entries.
You probably have heard of wildcard DNS, every subdomain request is routed to the same ip addres. Then entry in the DNS looks like *.example.com. So, www.example.com, dev.example.com, testing.example.com all will route to the same ip address.

What is less common, is wildcard DNS on a subdomain, like *.dev.example.com

But, this means, you can have an unlimited number of subdomains pointing to an ip address of your choice! Even a local IP address.

So, if you add *.dev.example.com with the IP address of your local XAMPP machine to the DNS, you can add, as an example, www.dev.example.com site.dev.example.com etc to your Apache virtual hosts configuration en voila. And the other devices on your network will have access too. You dont have to mess around with editing hosts files on your own machine and your other devices, or router DNS.

And a subdomain wildcard does not interfere with normal operation of the "live" website.

Adding ssl, https to the wildcard subdomains:

If you already have a wildcard ssl certificate for the domain, you can download the key and certificate, and add them to your XAMPP installation. If you dont, use this site to create a certificate and private key.

Just create a wildcard certificate for dev.example.com, or better :) , the domain you use. You then just have to add the root ca certificate to your devices and you are done.

Unlimited Virtual Hosts with SSL, available for all the devices on your local network.