windows下, nginx 提示错误 No input file specified
一 環(huán)境介紹:
win10,? LNMP
?
二 錯誤描述:
訪問網(wǎng)站時(shí),提示"No input file specified"錯誤.
排錯階段:
?
1. 查看nginx access日志 (access.log)
發(fā)現(xiàn)提示404 錯誤
?
2. 分析原因:
這時(shí),在同目錄下創(chuàng)建一個(gè)txt文件,訪問就可以正常輸出了
這說明 現(xiàn)在nginx 訪問php 沒有輸出,意味著沒有對php文件進(jìn)行解析
這樣問題就明朗了,多半和 cgi 以及 location的定義有關(guān)
?
3. 解決方案:
在對應(yīng)域名的vhost配置文件中添加對php文件的解析
注: 在項(xiàng)目中,我們經(jīng)常會用到redis,而有時(shí)我們項(xiàng)目出現(xiàn)莫名的錯誤,很可能就和redis有關(guān),所以,我們要養(yǎng)成一旦項(xiàng)目出現(xiàn)錯誤, 首先排查redis , 看redis 是否可以正常連接 .?
4. 具體配置文件代碼如下:
?
server {listen 80;server_name test.kk.com;charset utf-8;access_log logs/access/test.kk.com.access.log main;error_log logs/error/test.kk.com.error.log debug;root "E:/PHP/phpstudy/WWW/Project/kk";index index.html index.htm index.php;location /favicon.ico {log_not_found off;access_log off;}location /static/original {}location /static {access_log off;}location ~ \.php(.*)$ {fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_split_path_info ^((?U).+\.php)(/?.+)$;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;fastcgi_param PATH_INFO $fastcgi_path_info;fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;include fastcgi_params;}location / {if (!-e $request_filename) {rewrite ^/comic-detail-(\d+)/ /mh-$1/ permanent;rewrite ^/comic-detail-(\d+)/(\d+)/ /mh-$1/$2/ permanent;rewrite ^/show-(\d+)-(\d+)/ /mh-$1/$2/ permanent;rewrite ^/show-(\d+)-(\d+)-(\d+)/ /mh-$1/$2-$3/ permanent;rewrite ^/mh-(\d+)/(\d+)/$ /read-comic-$1-$2/ last;rewrite ^/mh-(\d+)/(\d+)-(\d+)/$ /read-comic-$1-$2-$3/ last;rewrite "^/uploads/manhua/\d+/\d{4}-(\d{3})-(\d{2})-(\d{2})-(\d{2})-(\d+)-(.*)$" /static/comic2/$1/$2/$3/$4/$5/$6 last;rewrite ^/(.*)$ /index.php?$1 last;}}location /union/ {rewrite ^/union/(.*)$ /union/index.php?$1 last;}location ~ /\.ht {deny all;} }?
?
后記:
在本地配置了一個(gè)本地站 ,nginx配置文件?
看起來似乎沒有什么問題,很簡單的一個(gè)配置,但是打開該域名后,卻發(fā)現(xiàn)報(bào)404。
反復(fù)檢查路徑,絕對沒有任何問題啊,怎么會連html文件都報(bào)404呢,如果連html文件都報(bào)404,那絕對不是因?yàn)閏gi的配置問題,肯定是和路徑有關(guān),但是路徑檢查了很多遍了啊,看看nginx 這個(gè)網(wǎng)站的錯誤日志看看有沒有什么收獲吧,反復(fù)看了之后,你猜我發(fā)現(xiàn)了什么?
what?居然是est,我配置文件里命名寫的是test這個(gè)單詞,忽然我想起來了,靠,他把我的 ‘\test中’的 '\t'給轉(zhuǎn)義了。
在前面再加個(gè)\轉(zhuǎn)義回來,問題得以解決,這個(gè)問題真的是太容易忽略了,記錄下來
總結(jié)
以上是生活随笔為你收集整理的windows下, nginx 提示错误 No input file specified的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 谷歌F12调试公众号时,让鼠标显示出来
- 下一篇: 装win10系统