Rails XSendfile via Nginx

Jonathan Matthews contact at jpluscplusm.com
Mon May 7 23:20:02 UTC 2012


On 8 May 2012 00:16, Jonathan Matthews <contact at jpluscplusm.com> wrote:
> On 7 May 2012 23:53, Ari King <lists at ruby-forum.com> wrote:
>> Hi,
>>
>> I'm trying to configure nginx to serve a video file on behalf of my
>> rails 3 backend using xsendfile. I want rails to redirect the request
>> for http://myapp.com/recipes/1/video to nginx to handle. Unfortunately,
>> my current configuration results in a 404 (page not found) error. I've
>> pasted my nginx configuration at http://pastebin.com/VA4QFM35
>>
>> Does anyone know what could be wrong?
>>
>> Note: I have activated X-Accel-Redirect in rails by:
>>
>> # Rails configuration (e.g. config/environments/production.rb)
>> config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
>
> Steps you could take / info you could provide:
>
> * hit the app direct with a curl invocation and examine the headers it
> creates. I bet you'll find the problem here.
> * re-read the alias docs. Your location{/recipe/...} looks a bit
> screwy, if the examples you've given are precise.

I forget step #0: examine the error log! It'll tell you where nginx is
failing to find your file, hence what the config problem might be ...

J
-- 
Jonathan Matthews
Oxford, London, UK
http://www.jpluscplusm.com/contact.html



More information about the nginx mailing list