Skip to content

Commit 5cd4283

Browse files
committed
unix socket instead of tcp sockets between nginx and php-fpm
1 parent df1a00c commit 5cd4283

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

config/fpm-pool.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ error_log = /dev/stderr
1313
; (IPv6 and IPv4-mapped) on a specific port;
1414
; '/path/to/unix/socket' - to listen on a unix socket.
1515
; Note: This value is mandatory.
16-
listen = 127.0.0.1:9000
16+
listen = /run/php-fpm.sock
1717

1818
; Enable status page
1919
pm.status_path = /fpm-status

config/nginx.conf

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ http {
5151
root /var/lib/nginx/html;
5252
}
5353

54-
# Pass the PHP scripts to PHP-FPM listening on 127.0.0.1:9000
54+
# Pass the PHP scripts to PHP-FPM listening on php-fpm.sock
5555
location ~ \.php$ {
5656
try_files $uri =404;
5757
fastcgi_split_path_info ^(.+\.php)(/.+)$;
58-
fastcgi_pass 127.0.0.1:9000;
58+
fastcgi_pass unix:/run/php-fpm.sock;
5959
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
6060
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
6161
fastcgi_index index.php;
@@ -79,7 +79,7 @@ http {
7979
deny all;
8080
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
8181
include fastcgi_params;
82-
fastcgi_pass 127.0.0.1:9000;
82+
fastcgi_pass unix:/run/php-fpm.sock;
8383
}
8484
}
8585

0 commit comments

Comments
 (0)