【发布时间】:2012-07-04 12:38:57
【问题描述】:
Nginx 1.1.4+ 可以使用 HTTP1.1 keepalive 指令提供上游连接,请参阅official documentation(它与 keepalived 客户端的连接不同)。所以 Unicorn 的配置如下所示:
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 "";
}
}
HTTP 连接需要这些标头:proxy_http_version 和 proxy_set_header。
所以问题是配置有效还是套接字连接本身是永久的?
【问题讨论】: