From 5cd428375b7ac875005dc2b5b47d811b034aa75d Mon Sep 17 00:00:00 2001 From: vildand Date: Thu, 16 Dec 2021 23:24:42 +0100 Subject: [PATCH] unix socket instead of tcp sockets between nginx and php-fpm --- config/fpm-pool.conf | 2 +- config/nginx.conf | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/fpm-pool.conf b/config/fpm-pool.conf index d469286..4be2061 100644 --- a/config/fpm-pool.conf +++ b/config/fpm-pool.conf @@ -13,7 +13,7 @@ error_log = /dev/stderr ; (IPv6 and IPv4-mapped) on a specific port; ; '/path/to/unix/socket' - to listen on a unix socket. ; Note: This value is mandatory. -listen = 127.0.0.1:9000 +listen = /run/php-fpm.sock ; Enable status page pm.status_path = /fpm-status diff --git a/config/nginx.conf b/config/nginx.conf index 7e90659..9e6efd8 100644 --- a/config/nginx.conf +++ b/config/nginx.conf @@ -51,11 +51,11 @@ http { root /var/lib/nginx/html; } - # Pass the PHP scripts to PHP-FPM listening on 127.0.0.1:9000 + # Pass the PHP scripts to PHP-FPM listening on php-fpm.sock location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; - fastcgi_pass 127.0.0.1:9000; + fastcgi_pass unix:/run/php-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_index index.php; @@ -79,7 +79,7 @@ http { deny all; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; - fastcgi_pass 127.0.0.1:9000; + fastcgi_pass unix:/run/php-fpm.sock; } }