Nginx,fastcgi PHP Windows,未指定输入文件

yoo*_*uri 5 fastcgi nginx

在端口 9000 上运行 php-cgi

Netstat 给了我

TCP 127.0.0.1:9000 DESKTOP-xxxxxxx:0 LISTENING [php-cgi.exe]

配置文件

http://pastebin.com/wkfz8wxw

每个php文件都给我这个No input file specified.错误...

SCRIPT_FILENAMESCRIPT_NAME也没有成功。。

我在 Windows 10 家庭版 x64

Ric*_*ith 6

您需要root在您的location ~ \.php$块内或从外部server块继承的指令中设置文档根。

解决方案可能是将root c:/Users/Youri/PhpstormProjects;线从location /块中移到其上方的位置。

通常fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;是指定脚本完整路径的正确方法,而SCRIPT_NAME通常只是最后一个元素。

像这样:

server {
    ...

    root   c:/Users/Youri/PhpstormProjects;

    location / {
        index  index.html index.htm index.php;
    }

    location ~ \.php$ {
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include       fastcgi_params;
    }
}
Run Code Online (Sandbox Code Playgroud)