Setting up Web Sharing for Yosemite

Content: Since Mac OS X 10.8 Mountain Lion, Web Sharing has been removed from the System Preferences panel. Every time I upgraded my system, my website stopped working. I had to reconfigure apache and php.

As I did several times in the past, I enabled userdir_module and php5_module by uncommenting the following 3 lines in /private/etc/apache2/httpd.conf:

LoadModule userdir_module libexec/apache2/
LoadModule php5_module libexec/apache2/

Include /private/etc/apache2/extra/httpd-userdir.conf

Then I uncommented the following line in httpd-userdir.conf to make sure per user configurations were included:

Include /private/etc/apache2/users/*.conf

And my user configuration /private/etc/apache2/users/Lionel.conf looked just great:

<Directory "/Users/Lionel/Sites/">
  Options Indexes MultiViews
  AllowOverride All
  Order allow,deny
  Allow from all

So I restarted apache and reloaded the webpage, but I got a Forbidden error message.

Strange, the last line of /var/log/apache2/error_log said:

[authz_core:error] ...: client denied by server configuration: /Users/Lionel/Sites/

What is this authz_core? After googling for a while, I finally got the answer. Apache that shipped along with Yosemite was upgraded to 2.4. The old mod_access_compat has been deprecated. We need to use mod_authz_host‘s new directives.

This is the new content of Lionel.conf:

<Directory "/Users/Lionel/Sites/">
  Options Indexes MultiViews
  AllowOverride All
  Require all granted

After restarting apache, everything starts to work now.