如何正确启用lighttpd错误日志?

我有一个启用Lighttpd和fastcgi的Centos 5系统。 它logging访问,但不logging错误。 我有内部服务器错误500和日志中没有信息,当我尝试打开不存在的文件也没有错误日志中的信息。 如何正确启用它?

以下是我启用的模块列表:

server.modules = ( "mod_rewrite", "mod_redirect", "mod_alias", # "mod_access", # "mod_cml", # "mod_trigger_b4_dl", # "mod_auth", "mod_status", "mod_setenv", "mod_fastcgi", # "mod_webdav", # "mod_proxy_core", # "mod_proxy_backend_fastcgi", # "mod_proxy_backend_scgi", # "mod_proxy_backend_ajp13", # "mod_simple_vhost", # "mod_evhost", # "mod_userdir", # "mod_cgi", # "mod_compress", # "mod_ssi", # "mod_usertrack", # "mod_expire", # "mod_secdownload", # "mod_rrdtool", "mod_accesslog" ) 

这里是debugging的设置:

 ## enable debugging #debug.log-request-header = "enable" #debug.log-response-header = "enable" #debug.log-request-handling = "enable" debug.log-file-not-found = "enable" #debug.log-condition-handling = "enable" 

设置错误和访问日志的path:

 ## where to send error-messages to server.errorlog = "/home/lxadmin/httpd/lighttpd/error.log" #### accesslog module accesslog.filename = "/home/lxadmin/httpd/lighttpd/ligh.log" 

fastcgi的设置:

 fastcgi.debug = 1 fastcgi.server = ( ".php" => (( "bin-path" => "/usr/bin/php-cgi", "socket" => "/tmp/php.socket", "max-procs" => 12, "bin-environment" => ( "PHP_FCGI_CHILDREN" => "2", "PHP_FCGI_MAX_REQUESTS" => "500" ) ))) 

在包含的configuration文件中我有:

 server.errorlog = "/home/httpd/mywebsite.com/stats/mywebsite.com-error_log" 

什么来日志文件

 /home/httpd/mywebsite.com/stats/ -rw-r--r-- 1 apache apache 5173239 May 16 11:34 mywebsite.com-custom_log -rwxrwxrwx 1 root root 0 Mar 27 2009 mywebsite.com-error_log /home/lxadmin/httpd/lighttpd/ -rwxrwxrwx 1 apache apache 2184 Apr 22 22:59 error.log -rwxrwxrwx 1 apache apache 6088621 May 16 11:26 ligh.log 

我给错误日志chmod 777试图检查是否是问题,但显然不是。

所以我的问题是:如何启用错误日志?

与Apache和nginx不同的是,您不能在每个虚拟主机日志文件中使用lighttpd中的错误消息。 server.errorlogvariables是lighttpd中的全局variables,请参阅function请求#665了解更多详细信息。

你的error_log似乎configuration得很好。

您是否尝试过使用lighttpd进程来查看是否打开了error_log?

 lsof -p `pidof lighttpd` 

另一方面,尝试强制执行相同的过程,同时强制发生内部错误:

 strace -o strace.out -p `pidof lighttpd` 

看看strace.out。 这不仅可以发现为什么error_log没有被写入,而且还可以自己debugging内部服务器错误问题。

将相同的“配方”应用于fastcgi进程。 我的猜测是这与lighttpd和fastcgi进程之间的连接失败有关。

希望这可以帮助。