Nginx 1.1.4+ can serve upstream connection with HTTP1.1 keepalive directive (it's not the same as keepalived clients' connections). So the Unicorn configuration can look like as below:
upstream unicorn {
server unix:/tmp/unicorn.todo.sock fail_timeout=0;
keepalive 4;
}
server {
try_files $uri/index.html $uri @unicorn;
keepalive_timeout 70;
location @unicorn {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://unicorn;
proxy_http_version 1.1;
proxy_set_header Connection "";
}
}
These headers are required for HTTP connection: proxy_http_version and proxy_set_header.
So the question is the configuration valid or socket-connection is permanent by itself?
Edited 1 time(s). Last edit at 07/05/2012 03:48AM by mikhailov.