Question

nginx keep_alive setting

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.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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.