Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

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|improve this answer
    
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 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!) –  Johannes H. Feb 18 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 at 23:06
    
403 can be caused by filesystem permissions and SElinux too which invalidates your first sentence. –  Iain Feb 18 at 23:12
    
@user56278 edited in that comment, so the answer is complete now. –  Johannes H. Feb 18 at 23:13
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.