Project

General

Profile

[Solved] Undefined config variable: lighty.r

Added by scar 7 months ago

I'm just trying to get some lua examples running, such as the lua mod_evasive which I put into a separate config file.  but lighttpd keeps failing to start and failing the config test:

Undefined config variable: lighty.r.req_attr
(configfile.c.2164) source: /etc/lighttpd/conf-enabled/15-lua-mod_evasive.conf line: 6 pos: 33 parser failed somehow near here: [
(configfile.c.2164) source: lighttpd.conf line: 11 pos: 0 parser failed somehow near here: (EOL)

lighttpd.conf looks like:

  1 server.modules = (
  2         "mod_access",
  3         "mod_alias",
  4         "mod_authn_file",
  5         "mod_deflate",
  6         "mod_redirect",
  7         "mod_setenv" 
  8 )
  9 
 10 include "/etc/lighttpd/conf-enabled/*.conf" 
 11 include_shell "/usr/share/lighttpd/create-mime.conf.pl"

So it's clearly getting stuck in processing the enabled config files, but mod_magnet is added to first since it's named 10-magnet

I saw some other definitions that split the variables instead, like:

local r = lighty.r 
local req_attr = r.req_attr

but then I just get: "Undefined config variable: lighty.r" instead.

No one else seems to have this issue since google couldn't find any similar results, so I must be missing some critical piece of info that everyone already knows is obvious... which is what??

lighttpd is 1.4.69 (ssl) from Debian 12 bookworm/main repo
(lib)lua is 5.4

thx


Replies (4)

RE: Undefined config variable: lighty.r - Added by gstrauss 7 months ago

The documentation for mod_magnet is for lua scripts. lua mod_evasive sample code is a lua script.

Please see mod_magnet for how to configure lighttpd.conf to run those external lua scripts.

It sounds like you are putting lua inside lighttpd.conf, and the lighttpd.conf syntax error is "Undefined config variable: lighty.r" since lighty.r is not a defined lighttpd configuration variable.

RE: [Solved] Undefined config variable: lighty.r - Added by scar 7 months ago

Yes, I am.  This was the critical piece of info I was missing!  Even after you mention it, though, it's still rather cryptic to me in the mod_magnet doc, and I'm unsure.

So: I'll rename /etc/lighttpd/conf-enabled/15-lua-mod_evasive.conf to /etc/lighttpd/scripts/mod_evasive.lua, for example.  Then, in /etc/lighttpd/conf-enabled/10-magnet.conf, I'd add this line:

magnet.attract-raw-url-to = ( "/etc/lighttpd/scripts/mod_evasive.lua" )  ?

Thx

RE: [Solved] Undefined config variable: lighty.r - Added by gstrauss 7 months ago

Have you tried reading the documentation more carefully to be able to answer that question yourself? mod_magnet Options

RE: [Solved] Undefined config variable: lighty.r - Added by scar 7 months ago

I had already read the docs multiple times as carefully as possible and it was still confusing, so no I just tried what I wrote and it turned out to be right...  I've actually never seen something like this before, with a module calling external scripting files, and never worked with lua either.  At first, I thought it was a hybrid type of setup, where I could use the magnet.attract-* options to call external scripts, or the scripts could be provided in-line, which is what I thought the lua mod_evasive code was.  Anyway, it's fine running now.  Thank you.  Like I said, apparently, I'm the only one, so far, who didn't understand this critical bit of info.  Therefore, I leave it to you to determine further clarifications to the documentation, if any.
Best,
Scar

    (1-4/4)