Update /etc/nginx/fastcgi_params a tout cassé

What type of hardware are you using: Raspberry Pi 3, 4+
What YunoHost version are you running: 12.1.39
How are you able to access your server: SSH
Are you in a special context or did you perform specific tweaking on your YunoHost instance ?: Update/mise à jour

Describe your issue

Salut,

j’ai lancé une mise à jour, j’ai voulu utilisé utilisé la dernière version de Nginx (malgré qu’il était recommandé de dire non, je pense que c’est mon erreur) et depuis tout est pété (cf retours ci dessous).

J’ai tenté un apt --fix-broken install mais ça m’a renvoyé:

Starting nginx.service - A high performance web server and a reverse proxy server…
2026/06/06 11:53:40 [emerg] 2735#2735: “fastcgi_index” directive is duplicate in /etc/nginx/fastcgi_params_with_auth:1
nginx: configuration file /etc/nginx/nginx.conf test failed
nginx.service: Control process exited, code=exited, status=1/FAILURE
nginx.service: Failed with result ‘exit-code’.
Failed to start nginx.service - A high performance web server and a reverse proxy server.
dpkg: error processing package nginx (–configure):
installed nginx package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)

Depuis je ne peux accéder au serveur que par SSH.
Il faut que je réinstalle tout ou une commande peut me sauver?

Share relevant logs or error messages

Configuration file ‘/etc/nginx/fastcgi_params’
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer’s version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a shell to examine the situation
The default action is to keep your current version.
*** fastcgi_params (Y/I/N/O/D/Z) [default=N] ? Y
Installing new version of config file /etc/nginx/fastcgi_params …
Installing new version of config file /etc/nginx/proxy_params …
Installing new version of config file /etc/nginx/scgi_params …
Installing new version of config file /etc/nginx/uwsgi_params …
Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 145.
(Reading database … 110786 files and directories currently installed.)
Preparing to unpack …/nginx_1.22.1-9+deb12u7_arm64.deb …
Unpacking nginx (1.22.1-9+deb12u7) over (1.22.1-9+deb12u4) …
Setting up nginx (1.22.1-9+deb12u7) …
Job for nginx.service failed because the control process exited with error code.
See “systemctl status nginx.service” and “journalctl -xeu nginx.service” for details.
invoke-rc.d: initscript nginx, action “start” failed.
× nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Sat 2026-06-06 11:43:15 BST; 7ms ago
Duration: 3w 4d 15h 32min 53.285s
Docs: man:nginx(8)
Process: 1741236 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
CPU: 30ms

Regarde s’il n’y a pas une archive en date de cette mise à jour: ls -la /etc/nginx/

merci pour ton retour rapide :slightly_smiling_face:

ca a renvoyé ça:

drwxr-xr-x 8 root root 4096 Jun 6 12:21 .
drwxr-xr-x 129 root root 12288 Jun 6 12:45 ..
drwxr-xr-x 14 root root 4096 Feb 11 20:54 conf.d
-rw-r–r-- 1 root root 1125 Feb 17 2025 fastcgi.conf
-rw-r–r-- 1 root root 2460 May 15 15:05 fastcgi_params
-rw-r–r-- 1 root root 1070 Apr 27 06:25 fastcgi_params.dpkg-old
-rw-r–r-- 1 root root 1238 Feb 11 15:15 fastcgi_params_no_auth
-rw-r–r-- 1 root root 1246 Feb 11 15:15 fastcgi_params_with_auth
-rw-r–r-- 1 root root 2837 Feb 17 2025 koi-utf
-rw-r–r-- 1 root root 2223 Feb 17 2025 koi-win
-rw-r–r-- 1 root root 4338 Feb 17 2025 mime.types
drwxr-xr-x 2 root root 4096 Feb 17 2025 modules-available
drwxr-xr-x 2 root root 4096 May 4 2025 modules-enabled
-rw-r–r-- 1 root root 1446 Feb 17 2025 nginx.conf
-rw-r–r-- 1 root root 1545 May 15 15:05 proxy_params
-rw-r–r-- 1 root root 1250 Feb 11 15:15 proxy_params_no_auth
-rw-r–r-- 1 root root 1174 Feb 11 15:15 proxy_params_with_auth
-rw-r–r-- 1 root root 2038 May 15 15:05 scgi_params
drwxr-xr-x 2 root root 4096 Jun 6 11:43 sites-available
drwxr-xr-x 2 root root 4096 May 4 2025 sites-enabled
drwxr-xr-x 2 root root 4096 Jun 6 11:43 snippets
-rw-r–r-- 1 root root 2067 May 15 15:05 uwsgi_params
-rw-r–r-- 1 root root 3071 Feb 17 2025 win-utf

Je dirais celui-ci: fastcgi_params.dpkg-old
Sur une machine version: 12.1.40.1

/etc/nginx/fastcgi_params   
fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
fastcgi_param  CONTENT_LENGTH     $content_length;

fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
fastcgi_param  REQUEST_URI        $request_uri;
fastcgi_param  DOCUMENT_URI       $document_uri;
fastcgi_param  DOCUMENT_ROOT      $document_root;
fastcgi_param  SERVER_PROTOCOL    $server_protocol;
fastcgi_param  REQUEST_SCHEME     $scheme;
fastcgi_param  HTTPS              $https if_not_empty;

fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
fastcgi_param  SERVER_SOFTWARE    nginx/$nginx_version;

fastcgi_param  REMOTE_ADDR        $remote_addr;
fastcgi_param  REMOTE_PORT        $remote_port;
fastcgi_param  REMOTE_USER        $http_ynh_user if_not_empty;
fastcgi_param  SERVER_ADDR        $server_addr;
fastcgi_param  SERVER_PORT        $server_port;
fastcgi_param  SERVER_NAME        $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param  REDIRECT_STATUS    200;

# !!! Security workaround !!!
# Do not use HTTP_HOST as "$http_host".
#
# "$http_host" is the Host header exactly as supplied by the client.
# This is unsafe when a client sends an absolute-form request target together
# with a different Host header, for example:
#
#     GET https://example.com/ HTTP/1.1
#     Host: malformedhost
#
# In such a case, passing "$http_host" upstream exposes the raw client-supplied
# Host value ("malformedhost") to the backend application, even though it does
# not match the effective request target. Applications often use HTTP_HOST for
# redirects, absolute URL generation, virtual host routing, or security checks;
# forwarding the raw Host header can therefore lead to incorrect or unsafe
# behaviour.
#
# Newer nginx versions (since 1.30.0) introduce variables "$is_request_port" and
# "$request_port", allowing HTTP_HOST to be constructed as:
#     $host$is_request_port$request_port
#
# In stable/oldstable packages we use "$host" as a security workaround.
# It avoids forwarding an untrusted raw Host header to the backend.
#
# Note: this changes behaviour compared to previous versions, because "$host"
# does not preserve the client-supplied port, while "$http_host" typically
# does. Existing deployments that rely on "$http_host" containing a port number
# may therefore break or behave differently after this change.

fastcgi_param  HTTP_HOST        $host;

Cool merci
Donc je copie tout ce qu’il y a dans fastcgi_params.dpkg-old et je le colle dans /etc/nginx/fastcgi_params c’est bien ça?
(désolé si ma demande est stupide mais je préfère vérifier avant de faire une bétise) :grimacing:

Bon de toute façon ça a pas l’air possible de copier coller

ah si c’est bon (désolé je sais pas pourquoi ça fonctionnait pas)

alors il semble qu’il n’y ait qu’une ligne de différence:

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

PHP only, required if PHP was built with --enable-force-cgi-redirect

fastcgi_param REDIRECT_STATUS 200;

et le old :

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param REMOTE_USER $http_ynh_user if_not_empty;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

PHP only, required if PHP was built with --enable-force-cgi-redirect

fastcgi_param REDIRECT_STATUS 200;

donc je change juste

fastcgi_param REMOTE_USER $remote_user;

par

fastcgi_param REMOTE_USER $http_ynh_user if_not_empty;

N’est ce pas?

ah ah j’ai testé ça n’a pas du tout marché :sweat_smile:

je vais attendre ton retour

au cas où j’ai regardé et je n’ai pas de partition remplie à 100% et je n’utilise pas de swap

Qu’as-tu comme retour ou message d’erreur?

quand je relance nginx j’ai ça:

service nginx restart
Job for nginx.service failed because the control process exited with error code.
See “systemctl status nginx.service” and “journalctl -xeu nginx.service” for details.

avec systemctl status nginx.service

× nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Sat 2026-06-06 15:54:31 BST; 48s ago
Docs: man:nginx(8)
Process: 3147 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
CPU: 40ms

Jun 06 15:54:31 nomdedomaine systemd[1]: Starting nginx.service - A high performance web server and a reverse proxy server…
Jun 06 15:54:31 nomdedomaine nginx[3147]: 2026/06/06 15:54:31 [emerg] 3147#3147: “fastcgi_index” directive is duplicate in /etc/nginx/fastcgi_params_with_auth:1
Jun 06 15:54:31 nomdedomaine nginx[3147]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jun 06 15:54:31 nomdedomaine systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Jun 06 15:54:31 nomdedomaine systemd[1]: nginx.service: Failed with result ‘exit-code’.
Jun 06 15:54:31 nomdedomaine systemd[1]: Failed to start nginx.service - A high performance web server and a reverse proxy server.

Et pour

sudo nginx -t
systemctl status nginx

2026/06/06 15:57:41 [emerg] 3317#3317: “fastcgi_index” directive is duplicate in /etc/nginx/fastcgi_params_with_auth:1
nginx: configuration file /etc/nginx/nginx.conf test failed

systemctl status nginx
× nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Sat 2026-06-06 15:54:31 BST; 5min ago
Docs: man:nginx(8)
Process: 3147 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
CPU: 40ms

Jun 06 15:54:31 nomdedomaine systemd[1]: Starting nginx.service - A high performance web server and a reverse proxy server…
Jun 06 15:54:31 nomdedomaine nginx[3147]: 2026/06/06 15:54:31 [emerg] 3147#3147: “fastcgi_index” directive is duplicate in /etc/nginx/fastcgi_params_with_auth:1
Jun 06 15:54:31 nomdedomaine nginx[3147]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jun 06 15:54:31 nomdedomaine systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Jun 06 15:54:31 nomdedomaine systemd[1]: nginx.service: Failed with result ‘exit-code’.
Jun 06 15:54:31 nomdedomaine systemd[1]: Failed to start nginx.service - A high performance web server and a reverse proxy server.

et

grep -n "fastcgi_index" /etc/nginx/fastcgi_params*

/etc/nginx/fastcgi_params_no_auth:1:fastcgi_index index.php;
/etc/nginx/fastcgi_params_with_auth:1:fastcgi_index index.php;

je viens de tenter ça avec les retours:

sudo apt --fix-broken install
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
Correcting dependencies… Done
The following additional packages will be installed:
nginx-extras
The following packages will be upgraded:
nginx-extras
1 upgraded, 0 newly installed, 0 to remove and 51 not upgraded.
1 not fully installed or removed.
Need to get 0 B/80.9 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Reading changelogs… Done
Setting up nginx (1.22.1-9+deb12u7) …
Job for nginx.service failed because the control process exited with error code.
See “systemctl status nginx.service” and “journalctl -xeu nginx.service” for details.
invoke-rc.d: initscript nginx, action “start” failed.
× nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Sat 2026-06-06 16:02:53 BST; 10ms ago
Docs: man:nginx(8)
Process: 4108 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=1/FAILURE)
CPU: 36ms

Jun 06 16:02:53 nomdedomaine systemd[1]: Starting nginx.service - A high performance web server and a reverse proxy server…
Jun 06 16:02:53 nomdedomaine nginx[4108]: 2026/06/06 16:02:53 [emerg] 4108#4108: “fastcgi_index” directive is duplicate in /etc/nginx/fastcgi_params_with_auth:1
Jun 06 16:02:53 nomdedomaine nginx[4108]: nginx: configuration file /etc/nginx/nginx.conf test failed
Jun 06 16:02:53 nomdedomaine systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Jun 06 16:02:53 nomdedomaine systemd[1]: nginx.service: Failed with result ‘exit-code’.
Jun 06 16:02:53 nomdedomaine systemd[1]: Failed to start nginx.service - A high performance web server and a reverse proxy server.
dpkg: error processing package nginx (–configure):
installed nginx package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)

:thinking:

grep -R "fastcgi_index" /etc/nginx
grep -R "include.*fastcgi_params" /etc/nginx