0

I am trying to setup my Apache local server. I noticed that my access was denied after I typed localhost into both Safari and Chrome. In Chrome it works but in Safari I given error 403 and told "Forbidden" and "you do not have permission to access / on this server"

So I have tried to modify the permissions of my Webserver directory using chmod in terminal. But even there I am told that the operation is not permitted. Even when attempting ls to view its contents, I am met with "Permission Denied"

keeg
  • 3,990
  • 8
  • 49
  • 97
user3167555
  • 73
  • 1
  • 8

2 Answers2

1

I've run into this issue from a couple of different angles on OS X. It seems as if you are having a permissions error.

I suggest you check out this post, what you need to do is make sure the _www group has access.But, BEFORE YOU DO WHAT THE ABOVE LINK SAYS, try a solution with Finder.

  • Go to the root web directory in your finder.
  • Right-click and 'Get Info'.
  • Look at the permission of the _www user. Make sure it has 'Read & Write' access.
  • Click the settings-cog on while _www is selected.
  • Select the following options: "Make _www the owner" and "Apply to enclosed items..."

Try accessing your web server now.

If this does not work, or if there is no _www user, revert back to the post I spoke of earlier.

Try the suggested lines in terminal:

Let DIR be the different directories leading to your website. Replace "~" with the full directory path.

For each parent directory leading to your web root (e.g. ~/my, ~/my/web, ~/my/web/root)

  • chmod go-rwx DIR (nobody other than owner can access content)

  • chmod go+x DIR (to allow "users" including _www to "enter" the dir)

Then apply these commands to just the web root.

  • sudo chgrp -R _www ~/my/web/root (all web content is now group _www)

  • chmod -R go-rwx ~/my/web/root (nobody other than owner can access web content)*

  • chmod -R g+rx ~/my/web/root (all web content is now readable/executable/enterable by _www)

Try to access your website again. If this doesn't work, go back to finder and try to add add the permissions again as stated in the first part of this post.

If you are using Server for OS X you may also enable and edit sharing properties for other users and FTP.

Community
  • 1
  • 1
musclez
  • 113
  • 1
  • 14
  • Cool thank you, I have solved the problem already using Disk Utilities repair permission. But if I have the same or similar problem in the future i will refer back to this post. – user3167555 Aug 04 '14 at 04:42
0

I have solved my problem with a simple fix:

  1. Open "Disk Utilities" from the "Utilities" folder in "Applications"

  2. Click on the root drive

  3. Click "repair permissions"

  4. Done

Jamal
  • 763
  • 7
  • 22
  • 32
user3167555
  • 73
  • 1
  • 8