Type this in the Go to Folder window: /private/etc/hosts From the finder window, click and drag the hosts file to the desktop. (We are doing this because we can’t open directly and edit it.) Double-click the hosts file (on the desktop), and it will open in TextEdit (or any default text editor on your Mac). Access localhost ( running on Mac OS X ) from another machine in the network. PuTTY dynamic port forwarding with access to localhost ports. A quick how to guide on how to set up localhost on a Mac. This will help you create and test multiple websites locally on your computer. This is for version.
Just a note, in case anyone has the same issue. At first I couldn't get this to work. I tried logging out and back in (still no joy), then restarting the mac (still no joy).
Try doing both of those first. However, if, like me, you still can't get the local host site to load, try the following: You should find a file at /Library/WebServer/Documents/index.html.en . This contains the text 'It works!' referred to in the post. What I did was duplicate that file in the same folder and changed the duplicate's name to 'index.html', leaving the original in situ.
Mac Os Mojave
Both local and user sites then loaded. After which, I was able to delete the duplicated file and everything now works without issue. Just to be clear, leave the original file index.html.en where it is, untouched and unharmed throughout this step.
Not sure why I had to take this mysterious detour - probably something local to my machine, but if you're having trouble after following the guide above, see if it helps.