
I can of course delete macbook.mysite1 now if I wish, but I find it’s convenient to keep both, particularly as the MacBook may not always be connected to my network. If not, I’ll be unable to access the virtual host and it will default to localhost on the iMac. The only difference from the previous example is that the name ( imac.mysite1) must be the same as that configured on the iMac. The IP address of the iMac on my network is 192.168.1.10, so to access the default localhost on the iMac from the MacBook I simply add the following to the MacBook’s /etc/hosts file:

For now we’re only interested in the default localhost. The /etc/hosts file on the MacBook is almost identical apart from the virtual hosts entry which is:

# localhost is used to configure the loopback interface The /etc/hosts file on the iMac looks like this: I have an iMac and a MacBook both of which have local server environments. However, it is possible to have any computer on a local network serve pages that are stored on another computer on that same network.

No big deal really as I currently use ChronoSync to synchronise my site’s folder structure across computers. This means that if I have a local site on computer A that I wish to access on computer B I have to replicate that site’s entire folder structure on computer B and on all other computers I want to access the site from. As it stands, the local server on each computer can only serve pages stored on that machine. I have several computers on my local network each with a local server environment provided by XAMPP.
