Project

General

Profile

[Solved] lighttpd exit on start. unknown config-key for fastcgi.server and url.rewrite modules.

Added by burning 22 days ago

My /etc/lighttpd/lighttpd.conf:
https://paste.lighttpd.net/h9#KVJ7B4PsJnbMrWCV4xctbcnm

My /etc/lighttpd/conf-available/15-fastcgi-php.conf:
https://paste.lighttpd.net/i9#TjN27Zlim4ZQ0Ir9MkkX9FIv

I'm trying to get lighttpd working. So far I've been able to load html files with it just fine, but php files pose an issue due to the necessary modules not being loaded in yet. So, I've been attempting to enable php-fpm to enable support for php files, and everything seemed to be going fine until I edited the 15-fastcgi-php.conf file and tried to run lighty-enable-mod fastcgi and lighty-enable-mod fastcgi-php. I didn't receive any error messages with that until I tried to force-reload lighttpd, which resulted in it exiting on startup for some reason.

systemctl status lighttpd.service outputs:

Jul 13 16:34:56 my_hostname systemd[1]: lighttpd.service: Control process exited, code=exited status=255
Jul 13 16:34:56 my_hostname systemd[1]: lighttpd.service: Failed with result 'exit-code'.
Jul 13 16:34:56 my_hostname systemd[1]: Failed to start Lighttpd Daemon.
Jul 13 16:34:56 my_hostname systemd[1]: lighttpd.service: Service hold-off time over, scheduling restart.
Jul 13 16:34:56 my_hostname systemd[1]: lighttpd.service: Scheduled restart job, restart counter is at 5.
Jul 13 16:34:56 my_hostname systemd[1]: Stopped Lighttpd Daemon.
Jul 13 16:34:56 my_hostname systemd[1]: lighttpd.service: Start request repeated too quickly.
Jul 13 16:34:56 my_hostname systemd[1]: lighttpd.service: Failed with result 'exit-code'.
Jul 13 16:34:56 my_hostname systemd[1]: Failed to start Lighttpd Daemon.

and the most recent entry in /var/log/lighttpd/error.log outputs:
2021-07-13 06:03:53: (log.c.217) server started
2021-07-13 06:03:53: (server.c.1295) WARNING: unknown config-key: fastcgi.server (ignored)
2021-07-13 06:03:53: (server.c.1295) WARNING: unknown config-key: url.rewrite-once (ignored)
2021-07-13 15:31:59: (server.c.1828) server stopped by UID = 0 PID = 1

I don't understand why it says the config-key is unknown. I thought I added the modules in my lighttpd.conf?


Replies (11)

RE: lighttpd exit on start. unknown config-key for fastcgi.server and url.rewrite modules. - Added by burning 22 days ago

could a moderator edit my post to remove my hostname where I listed the systemctl status of lighttpd.service? I missed that one.

I'd do it myself, but it doesn't seem this forum has an edit button after submission.

RE: lighttpd exit on start. unknown config-key for fastcgi.server and url.rewrite modules. - Added by gstrauss 22 days ago

(hostname removed)

Run lighttpd -f /etc/lighttpd/lighttpd.conf -p to print the lighttpd config that lighttpd sees, including all the include files.

RE: lighttpd exit on start. unknown config-key for fastcgi.server and url.rewrite modules. - Added by burning 22 days ago

Thanks, I appreciate it!

running lighttpd -f /etc/lighttpd/lighttpd.conf -p outputs:

Duplicate array-key '.php'
2021-07-13 17:44:44: (configfile.c.1154) source: /etc/lighttpd/conf-enabled/15-fastcgi-php.conf line: 12 pos: 1 parser failed somehow near here:
(EOL)
2021-07-13 17:44:44: (configfile.c.1154) source: /usr/share/lighttpd/include-conf-enabled.pl line: 3 pos: 1 parser failed somehow near here: (EOL)
2021-07-13 17:44:44: (configfile.c.1154) source: /etc/lighttpd/lighttpd.conf line: 49 pos: 1 parser failed somehow near here: (EOL)

RE: lighttpd exit on start. unknown config-key for fastcgi.server and url.rewrite modules. - Added by gstrauss 22 days ago

Failing to process the config file means lighttpd fails to restart, and the original is lighttpd process (if any) is left running. That's why you do not see the changes you made.

I am guessing, but your issue might be that you can not have both fastcgi-php and fastcgi-php-fpm both enabled at the same time.
Please review the output of lighttpd -f /etc/lighttpd/lighttpd.conf -p yourself and look for the duplication that lighttpd reported.

RE: lighttpd exit on start. unknown config-key for fastcgi.server and url.rewrite modules. - Added by burning 21 days ago

It reports the parser failing around line 12 in /etc/lighttpd/conf-available/15-fastcgi-php.conf (which is symlinked to /etc/lighttpd/conf-enabled/), but line 11 is the last line in the file, and is a closing bracket. So I'm unsure as to what in 12-fastcgi-php.conf is causing the issue, if that's the file that even is causing it.

Line 49 in lighttpd.conf is also the line after the final line in the config file. So I'm not sure here either.

I'm not sure where the "Duplicate array-key '.php'" would be. Or what that means exactly.

Would you know what might be stopping me from being able to run fastcgi-php and fastcgi-php-fpm simultaneously? According to all the guides I've found on setting up lighttpd with php, I should enable both modules.

RE: lighttpd exit on start. unknown config-key for fastcgi.server and url.rewrite modules. - Added by gstrauss 21 days ago

Would you know what might be stopping me from being able to run fastcgi-php and fastcgi-php-fpm simultaneously? According to all the guides I've found on setting up lighttpd with php, I should enable both modules.

Your first and most significant problem is reading comprehension. I have said that you can not use both. That is because they conflict. Yet you have repeated that you do not know where the conflict is.

RE: lighttpd exit on start. unknown config-key for fastcgi.server and url.rewrite modules. - Added by burning 21 days ago

Ah, apologies, I misunderstood. I was just confused because multiple guides I've comes across online have all said to enable both of those modules. Because of this, I thought that you were saying they conflicted due to something else I'd done, so I was wondering what their incompatibility was contingent on.

I've disabled fastcgi-php and lighttpd seemed to reload alright, though lighttpd still fails to start again.

Output of lighttpd -f /etc/lighttpd/lighttpd.conf -p:
https://paste.lighttpd.net/k9#xv7FRTHJqV3YqEjh6zpks2JN

the most recent error log:
https://paste.lighttpd.net/j9#Q5ut787TcI3JGYWsPW8SZaV1

The problem seems to be with fastcgi, or rather lighttpd's path to it. I just checked and the /opt directory is empty on my server. php-cgi is located in /usr/bin instead. Do you know where in lighttpd's config I can rejig it so it knows to look there instead?

RE: lighttpd exit on start. unknown config-key for fastcgi.server and url.rewrite modules. - Added by gstrauss 21 days ago

Enabling fastcgi and fastcgi-php-fpm is different from enabling fastcgi and fastcgi-php
You can not enable both fastcgi-php and fastcgi-php-fpm at the same time.

This site is lighttpd.net, not debian.net. lighttpd.net does not distribute conf-available or 15-fastcgi-php.conf or 15-fastcgi-php-fpm.conf. Those are Debian (or Ubuntu or Debian-based) add-ons.

RE: lighttpd exit on start. unknown config-key for fastcgi.server and url.rewrite modules. - Added by burning 21 days ago

Thanks for the clarification. I was unaware that such organisation of the file structure was unique to debian-based systems. I apologise if parts of my questions have meandered slightly off-topic. I'll try to stay more on-base in future posts.

Looking at my most recent error log for lighttpd which I posted above, it seems that lighttpd is looking in the wrong location for php-cgi. I was wondering how I might be able to redefine the path by which lighttpd seeks out php-cgi so it will look for it in /usr/bin/php-cgi/ rather than in /opt/php-fcgi/bin/php-cgi? As I'd imagine this would solve, at least, the seemingly current error being experienced in my install.

RE: lighttpd exit on start. unknown config-key for fastcgi.server and url.rewrite modules. - Added by gstrauss 21 days ago

Please try reading the logs that you have pasted.

2021-07-14 01:03:45: (log.c.217) server started
2021-07-14 01:03:45: (mod_fastcgi.c.1478) invalid "bin-path" => "/opt/php-fcgi/bin/php-cgi" (check that file exists, is regular file, and is executable by lighttpd)
2021-07-14 01:03:45: (mod_fastcgi.c.1159) the fastcgi-backend /opt/php-fcgi/bin/php-cgi failed to start:
2021-07-14 01:03:45: (mod_fastcgi.c.1163) child exited with status 2 /opt/php-fcgi/bin/php-cgi
2021-07-14 01:03:45: (mod_fastcgi.c.1166) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.\nIf this is PHP on Gentoo, add 'fastcgi' to the USE flags.
2021-07-14 01:03:45: (mod_fastcgi.c.1518) [ERROR]: spawning fcgi failed.
2021-07-14 01:03:45: (server.c.1269) Configuration of plugins failed. Going down.

The error invalid "bin-path" => "/opt/php-fcgi/bin/php-cgi" strongly suggesting that that line is "invalid". It even uses the word "invalid" in the error message.

Providing the path to the PHP executable "/opt/php-fcgi/bin/php-cgi" does not magically indicate to php-cgi the target PHP script you want to run. "bin-path" should point to the script for your application, which is probably not "php-cgi".
[Edit] I was confused by that. If you are using PHP-FPM, you should not provide "bin-path". Since you are not using PHP-FPM, you do need to provide the path to php-cgi to run the .php.
Please refer to the canonical lighttpd documentation for mod_fastcgi before random other sites on the internet.

RE: lighttpd exit on start. unknown config-key for fastcgi.server and url.rewrite modules. - Added by burning 21 days ago

What I was referring to in my previous post was that I am aware the line is invalid. I was asking where it is that I could edit it to render it valid again, but I see from the documentation you linked me that it was in lighttpd.conf anyway. I don't know why I assumed it'd be anywhere else. Thank you, the documentation is much more reliable a source than any external guide. I wish I'd realised this sooner.

I've edited the bin-path for fastcgi to instead go to /usr/bin/php-cgi.

Though lighttpd appears to start now, my web page is still inaccessible (even for .html files) and running systemctl status lighttpd reports the following error, stating that I seem to be incidentally calling the fastcgi module multiple times.

https://paste.lighttpd.net/m9#GN67WsMYbXhiAJQXUaPImUvd

I found the source of this issue. The debian add-on system was conflicting with the section I added in my config file and so the fast cgi module was being called twice by lighttpd. Once by /etc/lighttpd/lighttpd.conf, and again by /etc/lighttpd/conf-enabled/10-fastcgi.conf. Disabling one of the calls fixed it and I now get no errors in lighttpd as it starts up.

And with that, everything seems to be working fine now. Thanks very much for your help and your patience! :)

    (1-11/11)