Setup Apache on Mac OSX Leopard

I’ve had my Macbook for a little over a year now. However, I just recently found out Leopard comes with apache (apache2 to be specific) already installed. To verify this is true, open up Terminal and type

>> apachectl -V
Server version: Apache/2.2.9 (Unix)
Server built:   Sep 19 2008 10:58:54
Server's Module Magic Number: 20051115:15
Server loaded:  APR 1.2.7, APR-Util 1.2.7
Compiled using: APR 1.2.7, APR-Util 1.2.7
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D HTTPD_ROOT="/usr"
 -D SUEXEC_BIN="/usr/bin/suexec"
 -D DEFAULT_PIDLOG="/private/var/run/"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/private/var/run/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/private/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/private/etc/apache2/httpd.conf"

To start up apache, you can do it a couple of ways.

Type sudo apachectl -k start



  1. Go to System Preferences
  2. Click on Sharing
  3. Check the box that says Web Sharing

You can go to http://localhost or the URL provided in the Web Sharing screen to confirm apache is running and is able to serve up requests.

There is also a ~/Sites directory in your home folder. Apache is already setup to serve up files from this directory under http://localhost/~[username] where [username] is your user account name. Any files here will be render for example ~/Sites/index.html is accessible from the browser via http://localhost/~[username]/index.html.

One note to get this to work. Out of the box, all requests to /Sites result in a Forbidden 403 error. To resolve this issue, modify the conf file specified above as SERVER_CONFIG_FILE (/private/etc/apache2/httpd.conf in my case) from

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all


<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all

Restart apache (sudo apachectl -k restart) and try going to http://localhost/~[username] again.

Setup Apache on Mac OSX Leopard