1.No input file specified .

非常经典的问题。
哪怕是我这样装过两三次的非新手,也撞在这问题上。

和 404 not found 类似,这个错误的提示是 no input file specified 404 。

最后成功的配置文件,如下。


#user  nobody;
worker_processes  auto;
worker_rlimit_nofile 100000;#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;#pid        logs/nginx.pid;events {worker_connections  2048;multi_accept on;
}# 新增
# fastcgi.impersonate = 1
# cgi.fix_pathinfo=1
# cgi.force_redirect = 0http {#include       ../virtual_host/*.conf;include       mime.types;default_type  application/octet-stream;#log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '#                  '$status $body_bytes_sent "$http_referer" '#                  '"$http_user_agent" "$http_x_forwarded_for"';#access_log  logs/access.log  main;sendfile        on;#tcp_nopush     on;#keepalive_timeout  0;keepalive_timeout  65;#gzip  on;server {listen       80;# server_name  192.168.1.107 ;server_name localhost;# root "F:\Php_Projects\3K_Project\www.contestia.com\public";# root "F:/Php_Projects/3K_Project/www.contestia.com/public";# root "F:\Php_Projects\TODO_Laravel\new_version\public";root "F:/Php_Projects/TODO_Laravel/new_version/public";# root "F:/nginx_www";# root "F:\nginx_www";#charset koi8-r;#access_log  logs/host.access.log  main;index  index.php index.html index.htm;location / {# try_files $uri $uri/ /index.php;# try_files $uri $uri/ /index.php?$query_string;# Laravel路由专用 ↓ ↓ ↓try_files $uri $uri/ /index.php?$query_string;}#error_page  404              /404.html;# redirect server error pages to the static page /50x.html#error_page   500 502 503 504  /50x.html;location = /50x.html {# root   html;}# proxy the PHP scripts to Apache listening on 127.0.0.1:80##location ~ \.php$ {#    proxy_pass   http://127.0.0.1;#}# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000#location ~ \.php$ {#location \.php$ {fastcgi_pass   127.0.0.1:9000;fastcgi_index  index.php;fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;include        fastcgi_params;}# deny access to .htaccess files, if Apache's document root# concurs with nginx's one##location ~ /\.ht {#    deny  all;#}}# another virtual host using mix of IP-, name-, and port-based configuration##server {#    listen       8000;#    listen       somename:8080;#    server_name  somename  alias  another.alias;#    location / {#        root   html;#        index  index.html index.htm;#    }#}# HTTPS server##server {#    listen       443 ssl;#    server_name  localhost;#    ssl_certificate      cert.pem;#    ssl_certificate_key  cert.key;#    ssl_session_cache    shared:SSL:1m;#    ssl_session_timeout  5m;#    ssl_ciphers  HIGH:!aNULL:!MD5;#    ssl_prefer_server_ciphers  on;#    location / {#        root   html;#        index  index.html index.htm;#    }#}}

问题日志,揭露了一切问题:

F:/nginx-1.2.1/logs/error.log    line:7272017/10/27 10:01:35 [crit] 8148#1360: *2 GetFileAttributesEx() "F:ginx_www/index.php" failed (123: The filename, directory name, or volume label syntax is incorrect),client: 127.0.0.1,server: localhost, request: "GET /pic.jpg HTTP/1.1", host: "localhost"
F:/nginx-1.2.1/logs/error.log    line:4312017/10/26 23:56:43 [crit] 6936#3704: *1
GetFileAttributesEx()
"F:\Php_Projects\TODO_Laravelew_version\public/favicon.ico"  failed
(123: The filename, directory name, or volume label syntax is incorrect),
client: 127.0.0.1,
server: localhost,
request: "GET /favicon.ico HTTP/1.1",
host: "127.0.0.1",
referrer: "http://127.0.0.1/"

路途中走的弯路,这里就不说了。

总而言之,Bug产生的关键原因,在于:

1.我是从Windows的文件夹窗口的地址栏,复制地址,粘贴进 Nginx配置文件的 root 路径的。
2.Windows的文件夹分隔符,是 反斜杠 \。Nginx在解析的时候,把 \n 解析成了换行。结果 反斜杠 \字母 n 都丢失了。
3.我这里有三个例子,第1个,因为没有字母 n ,得以幸免。第二个例子,和第三个例子,路径都被 反斜杠 \n开头的文件夹,都转义掉了,所以产生了根本无法访问的路径。
4.所以,404 无法访问,就出现了。

网络上有很多篇说这个问题的垃圾攻略,但没有一篇能解决问题的。但取其精华,我学到了其它的知识

Nginx —— 指出常见nginx.conf文件配置的不规范之处
.user.ini 有关——Nginx报 No input file specified. 的问题解决之路

经验和反思

所以,一定要养成

1.查看日志的好习惯————>日志已经救了你两次了。第一次是逐行排查Nginx的PHP-FPM解析。第二次就是这里。
2.Fiddler监控网络请求,有时候有一点点帮助。
3.Windows的路径全部默认显示反斜杠,这是非常反人性,和非常容易出Bug的一点。切记切记!

塞翁失马,焉知非福。
这里也要感谢,这个 路径反斜杠转义 的错误,没有出现在我写第一个PHP接口时,连环出现。使得我能够躲过一劫,不至于陷入一层坑套一层坑的深坑中。
感谢!这也是我运气好的一方面!

配置Nginx时一定要小心(1)——目录拼写问题。相关推荐

  1. nodejs配置nginx 以后链接mongodb数据库

    服务器 :windows server2008 R2 反向代理 :nginx 1.15.1 for window 64位 数据库:mongodb 4 64位 使用框架express 首先下载nodej ...

  2. 从0开始,在Linux中配置Nginx反向代理、负载均衡、session共享、动静分离

    写这篇文章花费了我近一周的时间,参考网上许多优秀的博客文章,我不敢说写的很好,至少很全很详细.本文先介绍原理部分,然后再进行实战操作,我认为这样才会有更深的理解,不过这也导致了文章篇幅很长.但是,如果 ...

  3. centos7.9 配置nginx实现前后端分离

    工作中经常会遇到需要部署前后端分离的项目,今天来给大家介绍一下. 实验目的: 实现前后端分离配置,即nginx做代理,前端需要跳转到本地目录访问,后端需要跳转到后端程序. 服务器:CentOS Lin ...

  4. CentOS Linux 7 配置 nginx 支持 CGI

    Nginx 本身不能执行外部程序,Nginx 处理 PHP 是通过 PHP 的 fastcgi 管理器(php-fpm)进行处理,然后 nginx 再将结果返回给用户:所以如果我们需要通过 cgi 程 ...

  5. 配置nginx对php的支持

    配置nginx对php的支持 案例声明:本次案例所有软件包用的都是源码包 一.基本环境: 因为nginx与httpd服务用的是同一个端口,所以在安装nginx之前必须要停止apache服务,释放80端 ...

  6. 如何为 Flask Web 应用配置 Nginx

    原文地址:How to Configure NGINX for a Flask Web Application 原文作者:patricksoftware 译文出自:掘金翻译计划 本文永久链接:gith ...

  7. CentOS7.3 安装配置 Nginx、MariaDB、PHP

    CentOS7.3 安装配置 Nginx.MariaDB.PHP 配置 nginx 安装参数并安装 配置 以下参数也可以在后期通过配置 conf 文件进行配置 基本配置如下 ./configure - ...

  8. windows配置nginx实现负载均衡集群

    windows配置nginx实现负载均衡集群 2014-08-20 09:44:40   来源:www.abcde.cn   评论:0 点击:617 网上大部分关于nginx负载均衡集群的教程都是li ...

  9. Ubuntu Linux配置Nginx+MySQL+PHP+phpMyAdmin详细步骤

    博主之前一直用的是apache,随着网站负荷量增高,感觉apache稍微有点力不从心了.随着nginx越来越流行,而且其功能强大,博主准备采用nginx作为自己的服务器啦. 每当到了环境配置的时候,博 ...

最新文章

  1. 将客户端计算机加入域前建立计算机账户的必要性
  2. python之markdown转html
  3. xcode 5 使用 XCTest 做单元测试
  4. 如何简化React应用程序中的状态-轻松实现Redux
  5. MySQL中exists和in的区别
  6. MC9S12XEP100 本地RAM不够用了怎么办
  7. psp3000 java_psp上的python
  8. 百度云图片识别(ImageRecognition)
  9. 4.2 Branching Strategies
  10. 3600S软件测试工资,软件测试工资能拿到多少?谁说软件测试收入低?
  11. 如何通过微信小程序进行更加有效的电商营销?
  12. react中prop-types的使用
  13. 西门子博图功能指令——标准化
  14. python递归函数例子_Python递归函数经典案例-汉诺塔问题
  15. java hypot_Java StrictMath hypot()用法及代碼示例
  16. 利用Python根据模板生成Word文档
  17. 3、 如何搭建高德离线地图服务
  18. 《半小时漫画中国哲学史》——读书笔记
  19. 小型企业网络设计与规划
  20. 【进阶篇】全流程学习《20天掌握Pytorch实战》纪实 | Day03 | 文本数据建模流程范例

热门文章

  1. 按键连续点击的c语言程序,长按键C语言程序
  2. 共享自行车租赁管理系统单车-JAVA.JSP【数据库设计、毕业设计、源码、开题报告】
  3. iOS抖音风控加密算法的来龙去脉之设备注册deviceid(一)
  4. [附源码]计算机毕业设计基于SpringBoot的在线作业批改系统
  5. Pytorch的backward()与optim.setp()的理解
  6. 新书榜第一的《图解产品》,帮助内卷中的产品经理实现跨越式发展!
  7. C#迅雷七窗体特效,使用DWM实现Aero Glass效果
  8. 疫情之下,君子签电子合同助力企业人事合同灵活高效线上签
  9. 西数云服务器创建 ftp,WD My Cloud打造完美个人云服务器,Transmission+Aria2+FTP一帖式解决方案...
  10. IAT表入门简析【滴水逆向三期52笔记】