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


12

我有一个启用了Lighttpd和fastcgi的Centos 5系统。它记录日志访问,但不记录错误。我有内部服务器错误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" )

这是调试设置:

## 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"

设置错误和访问日志的路径:

## 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"
                         )
                 )))

在包含的配置文件中,我有:

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尝试检查是否是问题所在,但显然不是。

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

Answers:



7

您的error_log似乎配置正确。

您是否尝试过lsof您的lighttpd进程以查看是否打开了error_log?

lsof -p `pidof lighttpd`

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

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

看看strace.out。这不仅有用,不仅可以发现为什么不写入error_log,也可以调试内部服务器错误问题本身。

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

希望这可以帮助。


谢谢,我将尝试lsof,并做strace我仍然等待错误发生。
Tomasz Smykowski

我已经在系统上的许多Apache进程之一上尝试过lsof,但它没有打开的错误日志。但是现在我仍然没有这种错误情况。
Tomasz Smykowski
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.