Skip to content
Advertisement

File Not Found when running PHP with Nginx

Recently I installed the latest version of Nginx and looks like I’m having hard time running PHP with it.

Here is the configuration file I’m using for the domain:

server {
listen       80;
server_name  localhost;

location / {
    root   /usr/share/nginx/html;
    index  index.php;
}

error_page   500 502 503 504  /50x.html;
location = /50x.html {
    root   /usr/share/nginx/html;
}

location ~ .php$ {
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
    include        fastcgi_params;
}

}

Here is the error I’m getting on the error log file:

FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream

Advertisement

Answer

Try another *fastcgi_param* something like

fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement