2015-04-26 24 views
0

上次我使用Apache2 + PHP5作爲我的Web服務器,並且它運行正常,除非當服務器正在處理我的腳本並且我已將其更改爲lighttpd + fastcgi時,速度太慢。它比內存使用更快,內存使用率更低如何解決lighttpd「沒有指定輸入文件」。

我的問題是當lighttpd運行一段時間它「沒有指定輸入文件」。但一段時間沒問題。但是,當我重新啓動lighttpd每一個正常。 我不知道爲什麼以及如何解決它。

這是我的配置。

$SERVER["socket"] == ":80" { 

$HTTP["host"] == "xxx.xxx.xxx.xxx" { 
    server.document-root = "/var/www/public_html" 
    server.errorlog = "/var/www/public_html/logs/error.log" 
    accesslog.filename = "/var/www/public_html/logs/access.log" 
    compress.cache-dir = "/var/www/public_html/cache" 
} 

$HTTP["host"] == "sub.domain.com" { 
    server.document-root = "/var/www/public_html" 
    server.errorlog = "/var/www/public_html/logs/error.log" 
    accesslog.filename = "/var/www/public_html/logs/access.log", 
    compress.cache-dir = "/var/www/public_html/cache" 
} 
index-file.names = ("index.php", "index.html", "index.htm", "default.htm") 
url.rewrite-if-not-file = (
     "^/image(.*)" => "/image-api.php$1", 
     "^/go/([a-zA-Z0-9_-]+)" => "/index.php?go=$1", 
     "^/oembed(.*)" => "/oembed_provider/index.php$1", 
     "^/player$" => "/library/plugin/video-player/player.swf", 
     "^/v(.*)" => "/cvd.php$1", 
     "^/me" => "/user.php", 
     "^/@(.*)\?(.*)" => "/profile.php?indentity=$1&$2", 
     "^/@(.*)" => "/profile.php?indentity=$1", 
     "^/url?g=(.*)" => "/url.php?g=$1", 
     "^/social_auth/(.*)" => "/partner_api/$1.php", 
     "^/c/(.*)" => "/view.php?view=$1", 
     "^/u/(.*)" => "/profile.php?indentity=$1", 
     "^/project/(.*)" => "/section.php?page=$1", 
     "^/min/(.*)" => "/mini/index.php$1", 
     "^/src/(.*)" => "/src/$1", 
     "^/library/(.*)" => "/library/$1", 
     "^/\?(.*)" => "/index.php?$1", 
     "^/(.*)\?(.*)" => "/page.php?p=$1&$2", 
     "^/(.*)" => "/page.php?p=$1" 
     ) 

$HTTP["host"] == "domain.org" { 
url.redirect = ("/(.*)$" => "https://domain.com/$1") 
} 

$HTTP["host"] == "domain.info" { 
url.redirect = ("/(.*)$" => "https://domain.com/$1") 
} 

$HTTP["host"] == "domain.net" { 
url.redirect = ("/(.*)$" => "https://domain.com/$1") 
} 

} 

回答

0

FAQ,它看起來像有以下幾種可能:

嘗試使用PHP

可悲的是,當我得到的錯誤「未指定輸入文件」,這個錯誤消息可能意味着很多事情。 一個常見的解釋:PHP無法找到或打開它應該解析的文件。

這可以有很多理由:

  • 你忘了 添加 '' cgi.fix_pathinfo = 1到php.ini '' 文件。請參閱 中的意見PHP docs。這裏的問題是環境變量 SCRIPT_FILENAME沒有被傳遞給PHP。
  • 確保您沒有設置 的doc_root或用戶目錄在php.ini,或者如果你已經設置它,確保它 具有正確的值(doc_root的應在這種情況下匹配的lighttpd的 server.document根選項)
  • 如果設置了open_basedir,則確定 確定所請求的文件低於其中指定的目錄之一 。在過去的PHP解析文件不在 open_basedir,但這個安全問題是固定的(在 php-5.2.3左右)。
  • 如果您運行的是具有不同的權限 比lighttpd的(產卵-FCGI與-u/-g,execwrap,suexec的,...)PHP,檢查 PHP可以真正讀取文件

如果您無法找到/修復 問題,您可以使用strace來查看它是否與操作系統相關的權限 問題(查看stat *(... YOURFILE ...)= RETURNCODE)。在這種情況下,它可能幫助將max-procs設置爲1並且PHP_FCGI_CHILDREN(請參閱fastcgi 文檔),以便您可以輕鬆地將strace附加到 正確的php-cgi進程。

相關問題