How to make your XAMPP server available on all devices

Problems with the Windows version of XAMPP, questions, comments, and anything related.

How to make your XAMPP server available on all devices

Postby TonyVier » 26. May 2018 10:14

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

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 by typing in the ip address of your local machine. However, if you use named virtual hosts, you have 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 add your virtual domains there.

But there is a simpler 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 address. 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, we can have an unlimited number of subdomains pointing to an ip address of our choice!

SO, if you add *.dev.example.com with the ip address of your local XAMPP machine to the DNS, you can add, as example, www.dev.example.com site.dev.example.com to your virtual hosts file en voila. And the other devices on your network will have access too. You dont have to mess around with editing hosts files, 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, please read my tutorial for creating SSL certificates here: https://community.apachefriends.org/f/viewtopic.php?f=16&t=77006 or you can simply goto https://ssl.indexnl.com/ and make life easy.

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

Virtual Hosts with SSL, available for all the devices on your local network. :D
TonyVier
 
Posts: 43
Joined: 24. May 2018 11:22
XAMPP version: 7.2.5-0
Operating System: Windows 10 pro

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 85 guests