0
votes

I've read through every post I can find on the error message:
You don't have permission to access / on this server.

And I am not even sure what info to include. Definitely a newbie. Here's what I know. I am running Apache/2.4.16 on a Mac OSX Yosemite. At one point http://localhost returned "It works!". I then went to /etc/apache2, opened the file httpd.conf and removed the # (using MacRabbit Espresso) from the following lines:
LoadModule userdir_module libexec/apache2/mod_userdir.so
LoadModule alias_module libexec/apache2/mod_alias.so
LoadModule rewrite_module libexec/apache2/mod_rewrite.so
LoadModule php5_module libexec/apache2/libphp5.so

I restarted apachectl. Everything still seemed to be working fine at that point. (Although I did not retest localhost).

Here's where the problem seemed to have started. I created a new file info.php. I placed it in "/Library/WebServer/Documents". I then tried "http://localhost/info.php". That's when the permission errors started showing up. And that is when my evil hacker side took over. I used Finder to change permissions in several subdirectories, basically adding Read & Write permissions to me. The one oddity is that the httpd.conf file has permissions for me, wheel, and everyone. But no permissions for "system." (No clue as to whether or not that matters.)

End result: I got the permissions error I wrote about above.

So where do I go from here?

1

1 Answers

0
votes

Be careful changing permissions on random files as you can do damage to your system or create security holes in your machine.

Apache on OSX uses /Library/WebServer/Documents/ as the document root and Apache has a special user for running the webserver (which I believe on OSX is _www).

What I would suggest is following the instructions on the accepted answer in this question (Correct owner/group/permissions for Apache 2 site files/folders under Mac OS X?) which gives a very good answer, otherwise this guide here goes through not only setting up Apache, but configuring it to have user-level document roots.

If you feel confident in working in the command line yourself, the answer is to make sure that _www is allowed to read and execute files contained in the document root and is the owner of the document root.