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.

SOLUTION

Apache needs at least execute permissions on all the parent directories of the vhost dir.


I'm trying to set up a Rails app running under Apache on CentOS 4.3. I'm using Phusion Passenger (mod_rails) I made sure the app deployment dir is owned by group Apache and the permissions are set to allow the group to read it.

In my Apache config I have...

<VirtualHost *:80>

  ServerAdmin abc@def.com
  DocumentRoot "/home/sneedmoure/deployed_rails_apps/myapp/current/public" 
  ServerName myapp.com
  ServerAlias www.myapp.com
  ErrorLog "logs/myapp.com-error_log"
  CustomLog "logs/myapp.com-access_log" common
  CustomLog "logs/myapp.com-deflate_log" deflate

  <Directory "/home/sneedmoure/deployed_rails_apps/myapp/current/public">
    Order allow,deny
    Allow from all
#AllowOverride all       # Not sure whether I need this
    Options -MultiViews  # Passenger docs say to include this
  </Directory>

</VirtualHost>

When I try to access my app in the browser I get a 403 error.

In the error log I'm getting entries like...

[Wed Nov 25 03:01:19 2009] [error] [client 123.456.789.12] (13)Permission denied: access to / denied

I've tried different paths within the app and get the same result. It does work fine on my development machine.

Any notion what I'm doing wrong?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

The only reason I can think of is that the web server user doesn't have access to that directory (/home/sneedmoure/deployed_rails_apps/myapp/current/public).

You could verify that by su-ing to the web server user account and trying to list the directory.

share|improve this answer
    
Can't su to user apache. Apparently not a type of user that can log in. However, I'm pretty sure the permissions are OK. –  Agvorth Nov 25 '09 at 22:45
    
To su to it you'd need to edit /etc/passwd and temporarily change its shell to /bin/bash (or whatever your normal shell is). –  EMP Nov 26 '09 at 22:59
    
I moved it to a different dir under /. I think the deal was that user apache needs read and execute on the entire line of dirs leading to the application. –  Agvorth Nov 27 '09 at 23:33
    
It would need execute permissions on the entire directory tree, yes. Read permissions would only be needed on any web directories you want to list files in. –  EMP Nov 29 '09 at 22:04
add comment

Is there an index file (e.g. index.html, index.htm, etc) in that directory? If there isn't, it could be complaining b/c any request for that dir appears as an attempt to retrieve the directory listing. Can you create a blank file in that directory (e.g. test.txt) and successfully get it to load in a browser?

share|improve this answer
    
Good thought. But yes, there is an index file. –  Agvorth Nov 25 '09 at 22:45
add comment

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.