C4f1151075b447779af31e99d6cf70e2c6eb47ac
By:
newbie

nginx keep_alive setting

November 27, 2016 636 views
Nginx Server Optimization Ubuntu 16.04

Hello,
could somebody give me a clear explanation for these Nginx config

proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;

i have read the nginx documentation but some details explanation would be very much appreciated. like its not clear to me that i should use them only when im using upstream or even when using unix socket.

also if im using php, above will go into location php, right?

location ~ \.php$ {
            . . .
            proxy_http_version 1.1;
            proxy_set_header Connection "";
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $connection_upgrade;
            . . . 
            }

thanks in advance.

1 Answer

I don't think that the full set of headers is required for a unix socket. This guide provides some great examples of using nginx with fastCGI for PHP.

Nginx has become one of the most flexible and powerful web server solutions available. However, in terms of design, it is first and foremost a proxy server. This focus means that Nginx is very performant when working to handle requests with other servers. Nginx can proxy...
Have another answer? Share your knowledge.