How to enable error log in lighttpd properly?

I have a Centos 5 system with Lighttpd and fastcgi enabled. It does log access but does not log errors. I have Internal Server Error 500 and no info in log and when I try to open not -existing file also - no info in error log. How to enable it properly?

Below is list of modules that I've enabled:

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

Here are setting of 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"

Setting of path to error and access log:

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

#### accesslog module
accesslog.filename          = "/home/lxadmin/httpd/lighttpd/ligh.log"

Settings of 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"
                         )
                 )))

And in included config file I have:

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

What comes to log files:

/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

I gave error logs chmod 777 for a try to check if it's the issue, but apparently it's not.

So my question is: what to do to have error log enabled?


Unlike Apache and nginx, you cannot use per virtual host log files for error messages in lighttpd. server.errorlog variable is global in lighttpd, see Feature Request #665 for more details.


Your error_log seems to be well configured.

Have you tried to lsof your lighttpd process to see if it has the error_log opened?

lsof -p `pidof lighttpd`

On the other hand, try to strace the same process while forcing a internal error to occur:

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

Take a look at strace.out. This might be useful not only discovering why the error_log is not being written but also debugging the internal server error problem itself.

Apply the same "recipe" to the fastcgi processes. My guess is that this is related with connections failing between lighttpd and fastcgi processes.

Hope this helps.