Wrong documentation about fastcgi_param...

Dimitri dimitri_emich at protonmail.com
Sat May 28 12:38:45 UTC 2022


for a few hours yesterday i've had the Problem "FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream".

I use PHP-FPM with chroot and know about the configuration-problems with wrong "fastcgi_param SCRIPT_FILENAME ...", which you can find on the internet.

But my settings seems right:


> chroot = /test/website/example.com/Files

Nginx example.conf:

> root /test/website/example.com/Files;

> ...

> location ~ \.php$
> {
> try_files $uri =404;
> fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
> fastcgi_pass unix:/test/php/8.1.5/sockets/website.sock;}

But i get the Error "Primary script unknown...".
And in Browser i don't get the index.php, but only the text "File not found"

php access.log:

> - - 27/May/2022:14:05:02 +0000 "GET /index.php" 404

So i searched the internet, but without success...

Then i removed the SCRIPT_FILENAME-line in the example.conf nginx configuration file and
set the main SCRIPT_FILENAME-setting in my fastcgi.conf (which is included by nginx.conf) to
just "$fastcgi_script_name" (previously $request_filename) and all works as expectet.

The [Nginx-documentation](http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_param) say:
These directives are inherited from the previous configuration level if and only if there are no fastcgi_param directives defined on the current level.

But these directive WAS SET in the example.conf, so why nginx does not behave as stated in the docs?
Why nginx uses the global SCRIPT_FILENAME-setting, although these setting is on the "current level" in example.conf?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20220528/5a298533/attachment.htm>

More information about the nginx-devel mailing list