Note to myself: Built in OSX Apache Permission Denied, El Capitan, Yosemite

Yosemite el capitan

Always when I find myself fixing the same problem twice, I write a memo to myself.

Updating OSX is always a pain in the ass for me. 3 hours download on two computers, half an hour installation at least and afterwards something stops working. Because I want to keep my development machine as clean as possible, I have always used the built in Apache with my webprojects under my user/websites folder. I then point to the folder with a vhost assignment.

With every update, there comes a new Apache with a new httpd.conf. All your local websites probably stop working. Instead of copying the old configuration over, I use to make a backup of the new one and only change a few lines:

Of course you will have to load your vhost-file:

# Virtual hosts
Include /private/etc/apache2/extra/httpd-vhosts.conf

But that alone will result in 403. You will also want to include:

# User home directories
Include /private/etc/apache2/extra/httpd-userdir.conf

and to load the following:

LoadModule userdir_module libexec/apache2/mod_userdir.so

Then, following this article or this guide, you will have to create a “username.conf” file in

/etc/apache2/users/

with the following content:

<Directory "/Users/chris/Sites/">
AllowOverride All
Options Indexes MultiViews
Options +FollowSymLinks
Require all granted
</Directory>

I hope I did not forget something and could save you and me some time for the next update!


Comments