<div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);">Hi,</div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><br></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);">for a few hours yesterday i've had the Problem "<span>FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream</span>".</div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><br></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);">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.</div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><br></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><br></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);">But my settings seems right:</div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><br></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><b>PHP:<span><br></span></b></div><blockquote style="border-color: rgb(200, 200, 200); border-left: 3px solid rgb(200, 200, 200); padding-left: 10px; color: rgb(102, 102, 102);"><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><i><span>chroot = /test/website/example.com/Files</span></i></div></blockquote><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><br></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><b>Nginx example.conf: </b><br></div><blockquote style="border-color: rgb(200, 200, 200); border-left: 3px solid rgb(200, 200, 200); padding-left: 10px; color: rgb(102, 102, 102);"><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><i><span>root /<span>test/website/example.com/Files</span>;</span></i></div></blockquote><blockquote style="border-color: rgb(200, 200, 200); border-left: 3px solid rgb(200, 200, 200); padding-left: 10px; color: rgb(102, 102, 102);"><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><i><span>...</span></i></div></blockquote><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span><blockquote style="border-color: rgb(200, 200, 200); border-left: 3px solid rgb(200, 200, 200); padding-left: 10px; color: rgb(102, 102, 102);"><i><span>location ~ \.php$</span></i><div><i><span>{</span></i></div><div><i><span> try_files $uri =404;</span></i></div><div><i><span> fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;</span></i></div><div><i><span> fastcgi_pass unix:/test/php/8.1.5/sockets/website.sock;</span></i></div><i><span>}</span></i><br></blockquote></span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span><br></span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span>But i get the Error "Primary script unknown...".</span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span>And in Browser i don't get the index.php, but only the text "File not found"<br></span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span><br></span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><b><span>php access.log:</span></b></div><blockquote style="border-color: rgb(200, 200, 200); border-left: 3px solid rgb(200, 200, 200); padding-left: 10px; color: rgb(102, 102, 102);"><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><i><span><span>- - 27/May/2022:14:05:02 +0000 "GET /index.php" 404</span></span></i></div></blockquote><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span><br></span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span>So i searched the internet, but without success...</span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span><br></span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span>Then i removed the SCRIPT_FILENAME-line in the example.conf nginx configuration file and</span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span>set the main SCRIPT_FILENAME-setting in my fastcgi.conf (which is included by nginx.conf) to</span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span>just "$fastcgi_script_name" (previously $request_filename) and all works as expectet.</span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span><br></span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span>The <a href="http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_param">Nginx-documentation</a> say:</span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span>These directives are inherited from the previous configuration level
if and only if there are no <code>fastcgi_param</code> directives
defined on the current level.<br></span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span><br></span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span>But these directive WAS SET in the example.conf, so why nginx does not behave as stated in the docs?</span></div><div style="font-family: arial; font-size: 14px; color: rgb(34, 34, 34);"><span>Why nginx uses the global SCRIPT_FILENAME-setting, although these setting is on the "current level" in example.conf?<br></span></div>