the fast, reliable localhost tunneling solution


Mac OS X Personal Web Server

By Bjarni R. Einarsson 2011-01-14, 15:01

Mac OS X has an Apache web server built-in. To turn it on, simply go to system preferences and select "Sharing".

Pic1

If you are not signed in as an administrator everything is grayed out. You will need to press the lock in the left-hand corner and enter the administrator password,

Pic2

Check the "Web Sharing" box and your Apache server will be up and running within a few seconds.

Pic3

The root of your personal website (http://localhost/~YOURNAME) is now in

/Users/YOURNAME/Sites/

Pic4

Additional paths:

  • /Library/WebServer/Documents/ is analogous to /var/www/ in Linux
  • /Library/WebServer/CGI-Executables/ is analogous to cgi-bin. References to cgi-bin will point to that directory.
  • The Apache config file is /etc/apache2/httpd.conf (/etc/httpd/httpd.conf on older versions)

Files

Comments

  1. Bjarni R. Einarsson said on 2011-01-14, 09:52
    Many thanks to Einar Jón for the text and screen-shots!
    Permalink
  2. Victor said on 2013-03-27, 17:24
    Unfortunately, this doesn't work for Lion as the "Web Sharing" function has been removed in the latest OS X
    Permalink

Leave a comment

( (Please leave these blank: )

We use Gravatar for commenter's photos. Get your own, it's free!