-
Notifications
You must be signed in to change notification settings - Fork 98
Virtualhosts over a network
Traditionally, hosts created with virtualhost.sh only work from the host itself; that is, other computers (like a PC, for example) couldn't see the individual sites you were developing/hosting. Using dyndns.com, it is now possible to access your hosts externally. (Note that this includes Windows running inside Parallels, VMWare Fusion, or Sun Virtual Box.)
- Signup for an account at dyndns.com.
- Add a new Dynamic DNS host.
- Choose a hostname and domain. For this example, we'll use virtualhost and gotdns.org, respectively.
- Check the Yes, alias ".hostname.domain" to same settings checkbox.
- Enter your computer's local IP address. eg. 10.0.1.4
- Click on the Create Host button.
Now, anything?.virtualhost.gotdns.org is going to point at your machine from within your network. To ensure this works if your IP address changes, download the DynDNS Updater client. (The big download box on the right side of the page.) Configure it to use your computers local interface rather than the public IP it can detect.
Create a file in your home folder called .virtualhost.sh.conf, and define the WILDCARD_ZONE to be your new host:
echo 'WILDCARD_ZONE="virtualhost.gotdns.org"' >> ~/.virtualhost.sh.conf
When this is set, a ServerAlias will be defined for any virtualhost you create. So, if you create a virtualhost called awesomesite, you can then access it at awesomesite.virtualhost.gotdns.org. If you want to enable this on any virtualhosts you have already created, simply run the script again, and it will overwrite the original Apache virtualhost file.