OS X has a built in web server. For some users, especially web developers, it may come in rather handy. You can use it for locally hosting web sites (typically for development purposes), for running a local WebDAV server (which may, for instance, come in handy for local syncing of apps like OmniFocus).

When OS X 10.8 was released, Apple had removed the convenient “Web sharing” switch in the Sharing options of System Preferences. Here’s a couple of ways to start and stop you local Apache server:

1. With a GUI

There is a free Preference Panel available at Click On Tyler. One installed (takes a quick double-click)  you will have a new panel in your System Preferences which provides some very basic info about your Local Apache sites, and an easy way to turn the Apache server ON and OFF.

Web Sharing OS X

There is another Preference Pane here at Stowlake.com, although it says it works on 10.8 but nothing about 10.9 and above. It worth trying out though, if you want to give the GUI option a go.

2. Using Terminal commands

Personally, I recommend this method if you are getting into working with your system beyond the superficial (yet convenient) bling of the OS X GUI interface. Also, if you’re into developing web sites, becoming familiar with Apache commends on OS X is bound to come in handy over time.

To start the Apache server on OS X

or

(drop the -w if you don’t want this to persist after a system restart)

To stop the Apache server on OS X

or

(again, drop the -w if you don’t want this to persist after a system restart)

To restart the Apache server

It is important to note these particular commands are persistent. Meaning, if you start Apache using the first or second command above, it will persist through a system restart (i.e. Apache will restart after you restart OS X). Likewise, if you stop Apache with the third or forth command above, it will persist through a system restart. You can drop the -w from the second and forth command if you don’t want it to persist through a system restart.