2

Доброе время суток. Добрался до настройки Nginx с FastCGI на Fedora 24, но Nginx пишет

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"

Гуглю второй час, все бесполезно, пути верные

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_$
}
}

Не знаю уже, в чем проблема....

2 ответа 2

3

Спасибо, нашел решение сам. Проблема была в в конфиге php-fpm: поменял пользователя с дефолтного apache на тот, под которым запускается сервер, и все заработало.

Спасибо :)

2

Попробуйте так

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
  • Увы, этот вариант не изменил результат работы (
    – Za Ars
    21 дек 2016 в 17:36
  • Это очень странно, у меня работает именно этот конфиг. Возможно, проблема в настройках fpm. Попробуйте через unix-socket связать
    – ilyaplot
    22 дек 2016 в 7:18

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.