Lighttpd

使用 fastcgi.debug 指令時 Lighttpd 不會啟動

  • October 8, 2013

我在 Ubuntu 12.04 LTS 上執行 lighttpd/1.4.28 (ssl)。一切正常,我正在嘗試進行一些性能調整。我想為 fastcgi 模組啟用調試模式,但是當我將指令fastcgi.debug添加到我的 conf 文件時,lighttpd 因“解析器失敗”錯誤而窒息:

2013-10-08 10:56:23: (configfile.c.912) 
source: /etc/lighttpd/conf-enabled/15-fastcgi-php.conf 
line: 1 
pos: 15 parser failed somehow near here: (EOL)

配置文件是:/etc/lighttpd/conf-enabled/15-fastcgi-php.conf

fastcgi.debug=1

fastcgi.server += ( ".php" =>
   ((
           "bin-path" => "/usr/bin/php-cgi",
           "socket" => "/tmp/php.socket",
           "max-procs" => 1,  # runs max-procs bin-path controllers plus (max-procs * PHP_FCGI_CHILDREN) workers
           "idle-timeout" => 20,
           "bin-environment" => (
                   "PHP_FCGI_CHILDREN" => "10",
                   # PHP_FCGI_MAX_REQUESTS: The number of requests that a single worker handles before it kills itself.
                   "PHP_FCGI_MAX_REQUESTS" => "10000"
           ),
           "bin-copy-environment" => (
                   "PATH", "SHELL", "USER"
           ),
           "broken-scriptfilename" => "enable",
           "check-local" => "disable"
   ))
)

為什麼指令不被辨識?即使我將其設置為零,我也會收到錯誤消息。

我花了最後一個小時,終於跑到這個執行緒: http ://redmine.lighttpd.net/boards/2/topics/2265

線上程的最後,OP 提到從控制台以互動方式執行 lighttpd:

sudo lighttpd -Df /etc/lighttpd/lighttpd.conf

當我這樣做時,它列印出消息:

Duplicate config variable in conditional 0 global: fastcgi.debug

所以我 grep 了我所有的配置,果然,還有另一個帶有 fastcgi.debug 指令的文件。當我刪除 dup 條目時,lighttpd 啟動了。

lighttpd 應該將該消息寫入錯誤日誌!

引用自:https://serverfault.com/questions/544673