You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows 10下NGINX+PHP+FastCGI报错“No input file specified”求助

Hey KellyM, I’ve been there too—this error can be so frustrating when you’ve tried all the obvious fixes already. Let’s dig into some Windows-specific tweaks that might be the missing piece for you:

Troubleshooting "No input file specified" on Windows Nginx + PHP

  • Don’t overlook Windows file permissions
    Unlike Linux, Windows’ permission model is easy to miss. Make sure the user running Nginx (default is NT AUTHORITY\SYSTEM, or a custom user if you set one) has Read & Execute, List Folder Contents, and Read permissions for:

    • Your entire PHP application directory
    • The PHP interpreter’s installation folder
      To set this: Right-click your project folder → Properties → Security → Edit → Add the Nginx user (type NT AUTHORITY\SYSTEM if using the default) → Apply permissions to all subfiles/folders.
  • Validate path formats and FastCGI alignment
    Windows handles paths differently, so double-check these:

    • Use forward slashes in Nginx’s root directive (e.g., root C:/web/myapp/public; instead of C:\web\myapp\public—Nginx can parse backslashes, but forward slashes avoid escape character issues).
    • Confirm fastcgi_pass matches your PHP-FPM listen config. On Windows, PHP-FPM defaults to 127.0.0.1:9000—make sure the PHP-FPM service is running (check Services for "PHP FastCGI Process Manager").
  • Lock down your index and try_files logic

    • Ensure index.php is first in your index directive: index index.php index.html index.htm;
    • If your app uses a single entry point (like Laravel’s public/index.php), make sure root points directly to the public folder, and add this location block to route all requests through the entry file:
      location / {
          try_files $uri $uri/ /index.php?$query_string;
      }
      
  • Audit PHP-FPM’s www.conf settings
    Open www.conf (usually in [PHP安装目录]/php-fpm.d/) and verify:

    • listen = 127.0.0.1:9000 matches what’s in your Nginx config.
    • user and group are set to the same user running Nginx (default is NT AUTHORITY\SYSTEM).
    • Comment out any php_admin_value[doc_root] line—this can override Nginx’s document_root and cause path mismatches.
  • Test with a minimal configuration
    Strip down your Nginx server block to the basics to rule out conflicting rules:

    server {
        listen 80;
        server_name localhost;
        root C:/web/myapp/public;
        index index.php index.html;
    
        location ~ \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            include fastcgi.conf;
        }
    }
    

    Create a simple info.php file (<?php phpinfo(); ?>) in your root folder, restart Nginx and PHP-FPM, then visit http://localhost/info.php. If this works, gradually re-add your original config lines to find the conflicting setting.

内容的提问来源于stack exchange,提问作者KellyM

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:23:53