Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Ruby-on-Rails application that I am hosting with Apache and Phusion-Passenger (on Ubuntu Server). In this app I have a controller method that basically protects access to some files based on the currently logged in user and then servers them using X-sendfile. The method looks something like this:

def show
     if File.exists @file_name
         sendfile @file_name, :xsendfile => true

It mysteriously does not work on our staging server and I suspect It has something to do with file permissions because every time I hit it I get a 404 but it is not the 404 page that my would render as a result of my render404 call; thus I suspect the error is occurring after the sendfile line is executed.

Could someone please clarify for me what must the file permissions be in order for apache to server something via x-sendfile.

PS I should also point out that I am quite sure that my X-sendfile module is properly configured and working so its nothing to do with that

share|improve this question
up vote 1 down vote accepted

As always, it must be readable by the user the web server is running as.

share|improve this answer
Ya this should have been obvious... In the end the problem was that the group Apache was running as was not what I expected. I just learned about the envvars file... :s – Matthew Oct 28 '11 at 7:01

Your Answer


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.