From 384724cd72a9ba0d3f54b0c2f24635f760813860 Mon Sep 17 00:00:00 2001 From: Gregory Colpart Date: Mon, 26 Feb 2024 22:50:46 +0100 Subject: [PATCH] =?UTF-8?q?ajout=20de=20d=C3=A9tails=20pour=20la=20config?= =?UTF-8?q?=20Nginx=20/=20PHP-FPM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HowtoNginx.md | 21 +++++++++++++++++++-- HowtoPHP.md | 9 ++++++++- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/HowtoNginx.md b/HowtoNginx.md index 8d729186..a7d8ebc0 100644 --- a/HowtoNginx.md +++ b/HowtoNginx.md @@ -431,8 +431,25 @@ more_set_headers 'Server: My Server v42'; ### PHP-FPM -Vous devez [installer PHP-FPM](HowtoPHP#php-fpm) et puis [configurer -le vhost NGINX](HowtoNginx-PHP-FPM.md). +Vous devez [installer PHP-FPM](HowtoPHP#php-fpm) et [configurer un pool FPM pour être accessible sur une socket](HowtoPHP#configuration-fpm) du type : + +~~~ +[foo] +listen = /run/php/php-fpm.foo.sock +user = www-data +group = www-data +~~~ + +et enfin configurer un VirtualHost incluant une directive du type : + +~~~ +location ~ \.php$ { + fastcgi_pass unix:/run/php/php-fpm.foo.sock + include fastcgi_params; +} +~~~ + +Plus de détails sur [Configuration FPM avec Nginx](HowtoPHP#configuration-fpm-avec-nginx). ### Mode maintenance diff --git a/HowtoPHP.md b/HowtoPHP.md index 46b1efc9..7b96563c 100644 --- a/HowtoPHP.md +++ b/HowtoPHP.md @@ -252,7 +252,7 @@ rlimit_files = 65536 ~~~ On définit ensuite un ou plusieurs *pools* FPM via -`/etc/php/7.4/fpm/pool.d/*.conf` : +`/etc/php/7.4/fpm/pool.d/*.conf` du type : ~~~ [www] @@ -335,6 +335,13 @@ server { } ~~~ +L'utilisateur `www-data` doit accéder en lecture aux fichiers, il sera donc ajouté au groupe auquel ils appartiennent. +Ainsi pour un cloisonnement avec `/home/foo` appartenent à l'utilisateur `foo` et le groupe `foo`, on fera : + +~~~ +# adduser www-data foo +~~~ + #### Configuration FPM avec Apache Cela nécessite le module proxy_fcgi :