Bring my Apache back!

Last night, whilst demo-ing some older sites I developed, I realised that something had changed on the ole’ Mac—I could no longer preview content in my ~/Sites directory using OS X’s in-built Apache 2 server. Furthermore, the web sharing preference… he gone!

Never fear, Apache and OS X web sharing are still there: you just need to re-enable it all (gah!) So, here’s how to do it. First of all, fire up the trusty Terminal, and issue this command (replacing “<USER>” with your username):

vi /etc/apache2/users/<USER>.conf

A new file will open, and after putting the file into “insert” mode (i in vi), paste in the following (again, replacing “USER” with the necessary):

<Directory "/Users/USER/Sites/">
  Options Indexes Multiviews
  AllowOverride AuthConfig Limit
  Order allow,deny
  Allow from all

Save and exit (esc, then :wq in vi) and start up Apache:

sudo apachectl start

Note that this will only start up Apache for the current session. If you want it to run persistently, modify the relevant daemon setting like so:

sudo defaults write /System/Library/LaunchDaemons/org.apache.httpd Disabled -bool false

Once Apache is up and running, you should now be able to hit web pages in the usual way, e.g. http://localhost/~USERNAME/somesite/index.html.

If you’re still hitting problems (for example, I was getting 403 errors), these are probably permissions-related, and you need to alter permissions on the newly-created conf file from the step above (remember “USER”!):

  sudo chown root:wheel /etc/apache2/users/USER.conf
  sudo chmod 644 /etc/apache2/users/USER.conf


  1. If you don't fancy the Terminal, you can just install this:

    Works great, almost like back in the day.

    The reason(?) Apple did this is because they want you to buy OS X Server, which handles all this and much more. It's quite reasonably as well.

    /JJoacim Boive#

Comments on this post are now closed.


I’m a software architect / developer / general IT wrangler specialising in web, mobile web and middleware using things like node.js, Java, C#, PHP, HTML5 and more.

Best described as a simpleton, but kindly. You can read more here.