Welcome! Log In Create A New Profile

Advanced

Keepalived upstream connection to Unicorn via socket

Posted by mikhailov 
Keepalived upstream connection to Unicorn via socket
July 05, 2012 03:47AM
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.
Re: Keepalived upstream connection to Unicorn via socket
July 09, 2012 11:13PM
Unicorn documentation http://unicorn.bogomips.org/Unicorn/Configurator.html tells about keepalive:
"Since Unicorn is only designed for applications that send the response body quickly without keepalive, sockets will always be flushed on close to prevent delays."

Does it mean the nginx upstream connection overheaded?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 337
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready