Mac OS X Webserver



You can access your web page via http://localhost [your IP address]

For the personal web pages you can access via http://localhost[your IP address]/~username

———————- EDIT hosts FILE —————————

To edit the hosts file, you enable to access the web page by using some meaningful keyword; e.g. myfirstpage or myaccounts,

by editing the host file you can fake a domain name, but this only work on the local machine.

you can point to which is your local IP address. Ever time you go to, your web browser will load the web page from your local machine.

Edit hosts file in MAC need to do it in the Terminal because it is the system file and MAC design the OS does not show these files, so be caution with these steps

So far i find out 2 ways to edit the host file.

1. Use the Terminal to login using system admin right, tell the terminal to open up the textedit app which open the hosts file
command as follow:

sudo -s

[This command is to login the terminal with System Admin right, and this will ask you to input your password, just key it in and press enter, if your password is incorrect, it will ask you to input again.]
Then enter the following command to bring up the textedit app with hosts file open

/Applications/ /etc/hosts

2. Use the Terminal command line editor [nano] to edit the hosts file

sudo nano /private/etc/hosts

[If you not loged in, this command will ask you for the system password.]

Flush the DNS cache

dscacheutil -flushcache