Nginx+Php-Fpm - FastCGI sent in stderr: "Primary script unknown"
Good time of day. I got to setting up Nginx with FastCGI on Fedora 24, but Nginx writes
2016/12/21 08:12:51 [error] 3427#0: *4 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 127.0.0.1, server: yaboku.ru.local, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "yaboku.ru.local"
I google the second hour, everything is useless, the paths are right
server {
listen 80;
server_name yaboku.ru.local;
access_log /var/log/nginx/yaboku-nginx-access.log;
error_log /var/log/nginx/yaboku-nginx-error.log;
root /home/zaars/Project/Yii2/yaboku.ru/web;
location / {
index index.php index.html index.htm;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_$
}
}
I don't know what it is anymore problem....
2
2 answers
Thank you, I found the solution myself. The problem was in the php-fpm config: I changed the user from the default apache to the one under which the server is running, and everything worked.
Thanks :)
3
Author: Za Ars, 2016-12-21 17:57:04
Try this
set $yii_bootstrap "index.php";
location / {
index index.html $yii_bootstrap;
try_files $uri $uri/ /$yii_bootstrap?$args;
}
location ~ \.php {
fastcgi_split_path_info ^(.+\.php)(.*)$;
set $fsn /$yii_bootstrap;
if (-f $document_root$fastcgi_script_name){
set $fsn $fastcgi_script_name;
}
fastcgi_pass 127.0.0.1:9000;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fsn;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fsn;
location ~ /\.ht {
deny all;
return 404;
}
}
2
Author: ilyaplot, 2016-12-21 13:55:43