Project

General

Profile

Debugging a request - logging steps lighttpd takes

Added by worik almost 4 years ago

I have a fastcgi script that is not getting called.

It starts, listens on its socket but when a request arrives it does not reach my server.

I am looking for a way to trace the decisions that lighttpd makes when it processes my request.

I have been adding `debug.*` statements to my config file but they seem to have no effect.

How should I be doing it?

I have "mod_debug" in server.modules
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"

Even:
if req.path == "/dav/" { debug.show_events; }

I get nothing in the error log after the "server started" message.


Replies (5)

RE: Debugging a request - logging steps lighttpd takes - Added by gstrauss almost 4 years ago

mod_debug? if req.path == "/dav/" ? What version of lighttpd are you running? You're posting in the Support Forum for lighttpd 1.4 and that looks like (unreleased) lighttpd2

General advice: if you're trying to troubleshoot why something is not being called, simply your configuration to the bare minimum, get things workings, and incrementally add items back to your config and then test the config each step of the way. Double-check that you are actually restarting lighttpd and running the config that you think you are running.

To manually run lighttpd in the foreground, first stop whatever service is running lighttpd on your system, then
lighttpd -D -f /etc/lighttpd/lighttpd.conf
Ctrl-C to stop lighttpd.

Double-check your module ordering in lighttpd 1.4. mod_auth should come before mod_fastcgi
lighttpd -f /etc/lighttpd/lighttpd.conf -p

RE: Debugging a request - logging steps lighttpd takes - Added by worik almost 4 years ago

What version of lighttpd are you running

~# lighttpd -v
lighttpd/1.4.45 (ssl) - a light and fast webserver
Build-Date: Jun 24 2019 22:58:56

Double-check your module ordering in lighttpd 1.4. mod_auth should come before mod_fastcgi

I had no idea that ordering of modules could make a difference. But mod_auth does come before mod_fastcgi. I was ordering them alphabetically

To manually run lighttpd in the foreground, first stop whatever service is running lighttpd on your system, then
lighttpd -D -f /etc/lighttpd/lighttpd.conf

Ok. But it is very quiet about what is happening internally. Ho do I make it be verbose about what it is doing?

RE: Debugging a request - logging steps lighttpd takes - Added by gstrauss almost 4 years ago

if req.path == "/dav/" { debug.show_events; }

mod_debug and the above are not part of lighttpd 1.4.

The latest version of lighttpd is lighttpd 1.4.55, released Jan 2020. lighttpd 1.4.45 was released Jan 2017, 3 1/2 years ago. Since you're 10 major releases behind, have you considered testing with the latest version of lighttpd? The documentation in lighttpd was updated long ago to highlight that it is a bad idea to alphabetize the module list.

Ok. But it is very quiet about what is happening internally. Ho do I make it be verbose about what it is doing?

You already noted the directives to get lighttpd to add lots of noisy trace:

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" 
debug.log-timeouts = "enable" 

As I posted above:

Double-check your module ordering in lighttpd 1.4. mod_auth should come before mod_fastcgi
lighttpd -f /etc/lighttpd/lighttpd.conf -p

and consider attaching your config here.

General advice: if you're trying to troubleshoot why something is not being called, simply your configuration to the bare minimum, get things workings, and incrementally add items back to your config and then test the config each step of the way. Double-check that you are actually restarting lighttpd and running the config that you think you are running.

A minimal lighttpd config to run fastcgi is three lines. Three (3). That's it.
server.modules = ("mod_fastcgi")
server.document-root = "..."
fastcgi.server = ( ... )

If you have not tested a minimal configuration, please start there.

RE: Debugging a request - logging steps lighttpd takes - Added by gstrauss almost 4 years ago

You had FastCGI working on Ubuntu with lighttpd 1.4.53 back in January.
https://redmine.lighttpd.net/boards/2/topics/8889

RE: Debugging a request - logging steps lighttpd takes - Added by worik almost 4 years ago

Yes.
I have two installations in LXCs. One works, the other does not. This is a obscure bug and is probably due to a blindingly obvious simple error on my part. Sigh. The LXC that works is using unsupported Ubuntu 18.10

Frustrating.

I will do as you suggest with a 3-line config file. Very good advice.

I am definitely in favour of using `lighttpd` out of the repositories. The version I am using comes out of `ubuntu 18.04`.

Thank you for your attention and advice. Been very helpful.

    (1-5/5)