Your Mac has a built-in web server. To enable it, you go to System Preferences > Sharing > Enable Web Sharing. You’ll see a message saying: “Your computer’s website is available at this address.” The address shown is the IP address of your computer.
Make a note of that address. It’ll enable you to access your website from other computers on the same LAN. You can also access the site on your local machine using http://localhost or 127.0.0.1. Chances are your router, whether wireless or wired, assigns IP addresses to your computer on a first-come first-served basis. So, if you switch off your Mac, then switch it back on again the next day it may have a different IP address assigned to it. Here’s how to solve that.
Go to System Preferences > Network. Select the active network connection, whether wired or wireless, and click Advanced. Click the TCP/IP tab. Get out a pen and some paper or open up TextEdit – you’ll need to make some notes… Write down the IPv4 address, the Subnet Mask and the Router address. Next, select Manual from the Configure IPv4 menu. Enter the IPv4 address you noted down in the appropriate box – but change the last number to a higher, two-digit number. For example, if the IP address is 192.168.2.2 change it to 192.168.47. Why? When a DHCP server assigns IP addresses, it does so within a range in numerical order. Making the last digit a high number decreases the chance of a clash with other machines on your LAN. The Subnet Mask and Router address should already be filled in – but if not, you can fill those in from the notes you made. Click OK.