"ERROR: docroot is required for authorizer mode" although docroot is specified
I have tried out a mod_fastcgi configuration that included an FastCGI Authorizer. Various Ubuntu- and Debian-packages and also the current tarball of lighttpd gave this error:
2012-12-28 03:39:10: (log.c.166) server started
2012-12-28 03:39:10: (mod_fastcgi.c.1439) ERROR: docroot is required for authorizer mode.
2012-12-28 03:39:10: (server.c.938) Configuration of plugins failed. Going down.
After three days of fuddling, trying different variations, reading the mod_fastcgi documentation over and over again and searching the web all I found was this: http://redmine.lighttpd.net/boards/2/topics/3160 (unsolved).
I could not find any hint what could be wrong about my configuration so I suspected the config parser or mod_fastcgi of misinterpreting the configuration, although this seemed very unlikely on the other hand...
Cause & Solution¶
Out of desperation and just to be sure I dug into the parser and mod_fastcgi sources. Finally I found the cause: mod_fastcgi initializes the
fcgi_mode buffer once with an empty value, which defaults to "responder". But as soon as one section in the configuration explicitly sets a mode, this buffer is overwritten and will not be reset. So as soon as one section in the config sets the "authoritzer" mode, this mode is assumed as default for every following section, too.
I will append a patch that solves this problem.
- Explicitly set "mode" for all sections (at least for them following an authorizer section)
- Ensure that no responder sections follow an authorizer in the config
Workaround hint for Ubuntu/Debian¶If PHP is installed and activated for lighttpd by default there are three config files that are relevant for FastCGI:
- /etc/lighttpd/lighttpd.conf - main config that also loads all configs from /etc/lighttpd/conf-enabled
- /etc/lighttpd/conf-enabled/10-fastcgi.conf - general mod_fastcgi config
- /etc/lighttpd/conf-enabled/15-fastcgi-php.conf - activate php as FastCGI responder
mod_fastcgi: fix mix up of "mode" => "authorizer" in other fastcgi configs (fixes #2465, thx peex)
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2864 152afb58-edef-0310-8abb-c4023f1b3aa9
Updated by stbuehler over 5 years ago
- Target version set to 1.4.33
Thx, good catch.
Just one correction for your Workaround section: the order you put things into the config isn't always the order lighttpd interprets it in. use lighttpd -p to see the internal order.
Also I'm going to use a different patch; i think buffer_reset(fcgi_mode) each round should be good enough.
Also available in: Atom