0

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

2 Answers 2

0

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

7
  • 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.
    – Emmett R.
    Feb 18, 2014 at 21:44
  • 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!) Feb 18, 2014 at 21:52
  • 1
    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!
    – Emmett R.
    Feb 18, 2014 at 23:06
  • 403 can be caused by filesystem permissions and SElinux too which invalidates your first sentence.
    – user9517
    Feb 18, 2014 at 23:12
  • @user56278 edited in that comment, so the answer is complete now. Feb 18, 2014 at 23:13
0

Only one appointment to others, like me, that where getting fool with this same problem:

You said "I have checked for 755/777 permissions"

About this, it's important to know that, at least in Mavericks, it's necessary to give 755 permission to all the parents untill the user itself.

In my case, I had my working project on /Users/albertosanchez/Documents/Trabajo/Oficina2000/www.aliaxis-ui.es So I had to give permission 755 to albertosanchez, Documents, Trabajo, Oficina2000 & www.aliaxis-ui.es directories

Hope it helps!

Not the answer you're looking for? Browse other questions tagged .