Do I need to add any additional configuration to enable keepalive to my PHP-FPM backend?
upstream php_backend {
zone upstreams 64K;
server unix:/var/run/php-fpm.sock max_fails=1 fail_timeout=2s;
keepalive 10;
}
# Pass off php requests to PHP-FPM
location ~* \.php {
try_files $uri =404;
access_log /var/log/php-fpm/example_access.log;
include /usr/local/etc/nginx/php-fpm.conf;
fastcgi_pass php_backend;
}
In the following Nginx guides, when you don't use unix sockets you must add :
proxy_http_version 1.1;
proxy_set_header "Connection" "";
Source :
https://www.nginx.com/blog/avoiding-top-10-nginx-configuration-mistakes/#no-keepalives https://www.nginx.com/blog/avoiding-top-10-nginx-configuration-mistakes/#upstream-groups
Is there any additional config I need to add when using a unix socket?