Your Mac comes equipped with the same Apache web server software that has made its reputation by serving up commercial web sites. Configuring an Apache web server is not for the faint of heart, but Apple stepped up to the plate and made configuring Apache to serve up a basic user's web site a series of simple mouse clicks.
Create Your Web Site
Providing detailed instructions on creating a web site is beyond the scope of this tip. But for this tip to be of any use to you, you will eventually need to create your own web site, which is something you probably want to do anyway.
I recommend using your favorite HTML editor or one of the popular WYSIWYG web page editors to create your site. You should store the web site you create in your user Site directory, which is located at ~/username/Site. The name of the site's home page should be index.html.
Web Sharing was removed as a feature with the introduction of OS X Mountain Lion. If your using Mountain Lion or later, you can find instructions for web sharing in the article: Web Hosting With Mountain Lion. For OS X Lion or earlier, the instructions below will work to get your Mac setup as a web server.
Enable Web Sharing
Click the 'System Preferences' icon in the Dock.
Click the 'Sharing' icon in the Internet & Network section of the System Preferences window.
Place a check mark in the ‘Web Sharing’ box. (OS X 10.4 calls this box ‘Personal Web Sharing.') Web sharing will turn on.
That’s it; Apache web server will start up and serve at least two web sites, one for the computer, and one for each user on the computer. To access any of these web sites, open your favorite browser and enter any of the following:
http://your.computer.address/ This is the computer's web page. To find your computer's address, bring up the Sharing window you accessed above, and highlight the 'Web Sharing' name in the list. Your computer's address will display to the right.
http://your.computer.address/~yourusername This is your personal web page. To access it, enter the computer's address from the previous step, followed by the ~ (tilde) character and your user shortname, with no spaces in the shortname or between the tilde and your shortname.
If you're not sure what your shortname is, bring up the Sharing window you accessed earlier, and highlight the 'Web Sharing' name in the list. Your personal web site address will display to the right.