FastCGI sent in stderr: "Primary script unknown"

Chris Wijtmans cj.wijtmans at gmail.com
Thu Jan 26 21:05:19 UTC 2017


I wish to call a php script when a file is not found which is "gated"
from the rest. Meaning i dont want any php files executing in the
public domain. No user can trigger any php file, only when a requested
file is not found. What am i doing wrong? I tried searching the net a
bit but could not find anything useful.

       root /home/blah/public;
       index index.html;

       location /
       {
               error_page 403 404 = @http_request;
               try_files $uri $uri.html $uri/ =404;
       }

       location @http_request
       {
               root /home/blah;
               include         fastcgi.conf;
               fastcgi_pass    unix:/var/run/php-fpm/blah.sock;
               fastcgi_param SCRIPT_FILENAME   /home/blah/http_request.php;
               fastcgi_param SCRIPT_NAME       /http_request.php;
       }


2017/01/26 21:56:42 [error] 19384#19384: *1480 FastCGI sent in stderr:
"Primary script unknown" while r
eading response header from upstream, client: blah, server:
www.blah.*, request: "GET
/test HTTP/2.0", upstream:
"fastcgi://unix:/var/run/php-fpm/blah.sock:", host: "www.blah.nl"


More information about the nginx mailing list