After having to do that a few times here at work and forgetting how to do it and having to Google “How to make your localhost website accessible on your local network on Mac” everytime I needed to do it, I decided to write this simple tutorial to remind me how to do it.
I is really simple to do it. Just make sure your Apache server is running properly and follow this steps.
1. Change your vhosts file
First of all you have to edit your vhosts file and make sure that the website that you want to share with your peers is the first one on your list.
it should look like this:
SetEnv APPLICATION_ENV yourSite.localhost.com
options Indexes FollowSymLinks
Allow from all
2. Restart your Apache server
I know that is boring to have to restart your Apache server every time that you change something on your vhosts or on your hosts file but it has to be done to reflect the changes.
Don’t be affraid to open Terminal and run:
sudo apachectl restart
don’t forget to type your password.
3. Find your IP
Then you have to know your IP address on your local network. The easiest way to find out what is your IP on a Mac is opening the network preferences.
And then you can see your IP here:
4. Add the IP and site address to your colleagues hosts file
Make sure that your coworkers have your ip and the site address on their hosts file otherwise they will only see the first page of your beautiful site and only the text content of it! The Horror!!!
5. Open the IP address on your favourite browser
Ask for the person that will test the website for you to try it and it should work. Even on IE or other obscure Linux browser.
Be happy, it will work. Trust me!
I don’t know if that will work on a Windows or Linux box but it should because the settings are for a Apache server.