I have an application in Rails that runs with unicorn in production. Some calls take a long time to process. I configured the server to increase the timeout so that the server does not respond in error. The problem is that if the request takes more than 30 seconds, I get this message:
Service Unavailable
The service is temporarily unavailable. Please try again later.
No unicorn.rb
has timeout 120
configured and in nginx.conf I have:
upstream unicorn_my_app {
server unix:/tmp/my_app.socket fail_timeout=0;
}
server {
listen 80;
client_max_body_size 4G;
server_name www.my_app.com;
proxy_read_timeout 120;
keepalive_timeout 5;
root /home/ubuntu/my_app/current/public;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://unicorn_my_app;
break;
}
}
error_page 404 500 502 503 504 /erro/erro.html;
location = /erro/ {
root /home/ubuntu/my_app/current/public;
}
}
Are there any other settings I've forgotten?