FastCGI sent in stderr: "Primary script unknown"

Francis Daly francis at
Wed May 6 22:19:38 UTC 2015

On Tue, May 05, 2015 at 06:01:26AM -0400, vincent123456 wrote:

Hi there,

> I have this error : 
> 2015/05/05 11:48:32 [error] 5181#0: *5 FastCGI sent in stderr: "Primary
> script unknown" while reading response header from upstream, client:
>, server: myserver.local, request: "GET / HTTP/1.1", upstream:
> "fastcgi://", host: "myserver.local"

That error pretty much always means that the fastcgi server cannot find
the file that it thinks it was told to use.

Can you see in your fastcgi server logs what file the fastcgi server
thinks that was?

If not, you may be able to see in your nginx error logs, at debug level,
what fastcgi param values were sent. (You may see these using "tcpdump"
too, if that is simpler to set up.)

The specific fastcgi param that the fastcgi server uses depends on the
server, but it is commonly SCRIPT_FILENAME. If more that one value is
sent, which one the server chooses depends on the server.

The filename that nginx sends in the fastcgi param must be from the
perspective of the fastcgi server -- so if the fastcgi server runs in
a chroot, what nginx sends must be adapted.

If you "ls -ld" every directory on the path to the file, do they all have
"x" permission for the fastcgi-server user?

Good luck with it,

Francis Daly        francis at

More information about the nginx mailing list