Primary script unknown error - can't figure out how to fix

Francis Daly francis at
Tue Jan 8 20:09:49 UTC 2013

On Tue, Jan 08, 2013 at 08:08:33PM +0100, Patrick Lists wrote:

Hi there,

> I'm seeing some "Primary script unknown" errors 

That message from the fastcgi server usually means that the
SCRIPT_FILENAME that it was given was not found as a file on its

Your filesystem has:

> # ls -l /usr/share/nginx
> drwxr-xr-x. 12 root root 4096 Jan  8 18:47 piwik
> # ls -l /usr/share/nginx/piwik
> -rw-r-----.  1 nginx nginx  1611 Mar 20  2012 index.php

But your nginx config file has:

>     root /usr/share/nginx/;

>     location = /index.php {
>         fastcgi_param   SCRIPT_FILENAME 
> $document_root$fastcgi_script_name;
>     }

so SCRIPT_FILENAME will be /usr/share/nginx/

Which does not exist, and so is not found.

> Any advice or pointers to docs where I can find a solution are most 
> appreciated.

Set "root" correctly in the nginx config. (Which is more or less the
same as "set the directory name correctly in the filesystem".)

Francis Daly        francis at

More information about the nginx mailing list