2

I have Passenger configured on my nginx server to serve a Rails app from a specific domain.

I need a certain path (/works) on my app not to time out after 60s because it takes a while for me to upload files and I suspect the timeout is firing too early. I wanted to use proxy_connect_timeout to solve the issue.

I tried to use a location block specific to that path in order to increase the timeout, but it causes every request for /works (or any subpath) to result in a 404.

server {
    listen 80;
    server_name myserver.com;
    root /path/to/my/app/public;
    passenger_enabled on;

    location /works {
        proxy_connect_timeout 300s;
    }
}

This is the entry in error.log:

2014/02/10 04:30:31 [error] 9579#0: *4 "/path/to/my/app/public/works/index.html" is not found (2: No such file or directory), client: 0.0.0.0, server: myserver.com, request: "GET /works/ HTTP/1.1", host: "myserver.com"

From what I can glean from that entry, it seems to look into public as if it didn't know it should pass the request to Rails. I also tried enabling passenger from that location block but with no luck.


How do I get this to work? Is there also a way to make the location block only act on /works and not on any subpath (e.g. /works/1)?

kettlepot
  • 10,574
  • 28
  • 71
  • 100

1 Answers1

1

You must re-specify passenger_enabled in each location block.

From the Phusion Passenger users guide:

When using location blocks, you must re-specify passenger_enabled in each location block that you want to enable Phusion Passenger. This is because each location block has passenger_enabled turned off by default.

kettlepot
  • 10,574
  • 28
  • 71
  • 100
Hongli
  • 18,682
  • 15
  • 79
  • 107
  • Thanks, I'll try this again. I thought I had already tried it and it wasn't working, but maybe I just did something wrong. – kettlepot Feb 10 '14 at 13:53