For now, let’s assume you own domain example.com and want to set up a single HTTP site on your VM. First, we need to tell your VM to look for example.com locally rather than on the internet. Right now if you type http://example.com into your browser address bar you will go out to the internet and retrieve that public site (give it a try). We need our VM to look at its Apache server instead for example.com. To do that you modify your VM’s loopback mechanism with has an IP address of 127.0.0.1 and has a default name of localhost.
To make example.com local and use the loopback mechanism, your edit your VM’s C:\windows\system32\drivers\etc\hosts file. This is a hidden system file, you need to edit it with notepad running as Administrator. You can do that by clicking on the Windows Start button (lower left) and type notepad. On the notepad icon right-click and select Run As Administrator. Click Open and navigate to C:\windows\system32\drivers\etc and then type hosts as the filename. Note that you won’t see the hosts file in that folder because it is a hidden system file. Add a new line and type in 127.0.0.1 example.com but use the domain name you have selected. Note that you do not add the www prefix. You can add any number of local domains to this file.
With previous versions of Windows, you had to restart the computer to see the change. In Windows 10 they have eliminated the need to do that. In your VM browser type in example.com and you will now see the Xampp page show up.