Rails XSendfile via Nginx

Ari King lists at ruby-forum.com
Wed May 9 22:17:14 UTC 2012


> Appreciate the help.
>
> -Ari

**I also tried hard-coded values, but that still results in a 404
error.**

upstream xxx.xxx.xxx.xxx {
         server 127.0.0.1:3000;
         server 127.0.0.1:3001;
         server 127.0.0.1:3002;
}

location ~ /lessons/1/video/(.*) {
              internal;
              alias /var/www/app/current/uploads/videos/1/original/$1;
          }

location / {
             proxy_redirect off;

             proxy_set_header X-Real-IP $remote_addr;
             proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;

             proxy_set_header X-Sendfile-Type X-Accel-Redirect;
             proxy_set_header X-Accel-Mapping
/lessons/1/video/=/var/www/app/current/uploads/videos/1/original/;

             proxy_connect_timeout 75;
             proxy_send_timeout 60;
             proxy_read_timeout 60;
             root /var/www/app/current/public;

             if (!-f $request_filename) {
                 rewrite ^(.*)$ $1 break;
                 proxy_pass http://xxx.xxx.xxx.xxx;
                 break;
             }
         }

-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list