Welcome! Log In Create A New Profile

Advanced

Nginx upstream unix socket keepalive?

Posted by Mayhem30 
Nginx upstream unix socket keepalive?
August 10, 2022 11:24PM
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?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 111
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready