XAMPP 403 after all permissions set - OSX 10.9.1

5,398

403 does not indicate insufficient permissions for the server to read the file, but insufficient rights for the client to view the requested URL (the server doesn't even try to access any file, maybe not even map the request to one depending on where the access rights are defined).

As your access rules for /Users/myuser/Sites/testsite seem correct, you should check if:

  • /Users/myuser/Sites/testsite really is the document root / directory the request is mapped to (and note that this is an absolute path on your computer, not relative to the document root!)

  • No other Access rules are specified anywhere that may override this one (possible locations are any server congi file, including but not limited to vhost definitions, as well as .htaccess files)

  • In case you're having any symlinks in there, make sure apache is set to follow them (Options +FollowSymlinks or Options +SymLinksIfOwnerMatch).

  • In case you're requesting a direcotry and not a file: Make sure Indexing is turned on. (Options +Indexes)

  • Make sure you're really hitting the vHost you think you are, not another one or none at all

Share:
5,398

Related videos on Youtube

Emmett R.
Author by

Emmett R.

I'm something of a cross between a mechanical engineer, an IT professional, and a book editor. While I don't know everything, I am unshakable in the quest for more knowledge, and I have a memory like a steel trap.

Updated on September 18, 2022

Comments

  • Emmett R.
    Emmett R. over 1 year

    I tried installing the latest version of XAMPP as a simple testing platform to demo PHP on before moving to our production server. I set up a couple of virtual hosts for convenience, but they invariably throw 403 at me.

    I have recursively chown'd the directories, I have declared the domains in the hosts file, I have checked for 755/777 permissions, I have adjusted the apache user and group, I have checked httpd -S for errors, I have resolved the server name in httpd.conf, I have included the oft-suggested Require code in my declarations to httpd-vhosts.conf as follows, in various arrangements and permutations:

    <VirtualHost *:80>
    DocumentRoot "/Users/myuser/Sites"
    ServerName localhost
    </VirtualHost>
    
    <VirtualHost *:80>
    DocumentRoot "/Users/myuser/Sites/testsite"
    ServerName testsite.loc
    ErrorLog "/private/var/log/apache2/testsite_error_log"
        <Directory "/Users/myuser/Sites/testsite">
            Options Indexes FollowSymLinks Includes ExecCGI
            AllowOverride All
            Order Allow,Deny
            Allow from all 
            Require all granted 
        </Directory>
    </VirtualHost>
    
    <VirtualHost *:80>
    DocumentRoot "/Users/myuser/Sites/home"
    ServerName home.loc
    ErrorLog "/private/var/log/apache2/home_error_log"
        <Directory "/Users/myuser/Sites/home">
        Options Indexes FollowSymLinks Includes ExecCGI
            AllowOverride All      
            Order Allow,Deny       
            Allow from all         
            Require all granted    
        </Directory>
    </VirtualHost>    
    

    I have reset the server every time I made a change, it doesn't seem to be generating an error log, and I have no clue what's going on. If there is anyone who can give me a trail to follow, or a clue how to proceed in solving this, I would be immensely grateful. This problem has been dogging me for two days straight.

    Please note, I am not a server admin by training, just an engineer that fell into the job. I don't need simple explanations, but I do need a little more explicitness than usual. Thanks.

    (For reference, the system I am required to work in is OSX 10.9.1. Let me know if there is any more data I am missing for the solution.)

    Edit: Included the full vhosts code

  • Emmett R.
    Emmett R. about 10 years
    Thanks for replying. I went down your points. I double-checked the directory paths, they seem correct. I tried setting AllowOverride None, in the hopes that it would disable all .htaccess files, but to no effect. As for the last two, both options are already set in my declaration above.
  • Johannes H.
    Johannes H. about 10 years
    Mind to post your whole vhost config file for that vhost then? ANd make sure you are really hitting that vhost and not any other (or none at all!)
  • Emmett R.
    Emmett R. about 10 years
    That last comment was the key. The path in httpd.conf pointing to vhost was relative. Changing it to absolute was what fixed it. Thanks a million!
  • user9517
    user9517 about 10 years
    403 can be caused by filesystem permissions and SElinux too which invalidates your first sentence.
  • Johannes H.
    Johannes H. about 10 years
    @user56278 edited in that comment, so the answer is complete now.
  • user9517
    user9517 about 10 years
    Yes i know I'm right, we get questions about it here all the time. In my experience perms/SELinux are more often than not the cause of a 403 so they are at the top of my checklist.