Lighttpd/external.conf edits break lighttpd

I am trying to edit /etc/lighttpd/external.conf so that I can save my port configuration from being overwritten when making updates to my pihole. It is completely empty when I access it, and on the first line I type server.port = 8099. I then save and attempt to restart lighttpd, but I get this error message:

Job for lighttpd.service failed because the control process exited with error code.
See "systemctl status lighttpd.service" and "journalctl -xe" for details.

I then go in and delete that one line, and everything works fine. Everything also works fine when I change the port in /etc/lighttpd/lighttpd.conf. Any idea what's going on and why this won't work?

1 Like

Check the lighttpd error log, but it probably fails with a duplicate config value. To replace a value, instead use the syntax (note the colon and lighttpd version requirement):

replace

NAME := VALUE

(replace/overwrite earlier value) (since 1.4.46)

See: https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_Configuration for more on the config syntax.

3 Likes

Particularly note the := operator (which is only supported in lighttpd version 1.4.46 and above)

2 Likes

tried this, same error code :confused:

Here is the output from the error log

2022-01-30 00:00:49: server.c.1787) logfiles cycled UID = 0 PID = 4351
2022-02-03 22:46:29: server.c.1976) server stopped by UID = 0 PID = 1
2022-02-03 22:46:41: server.c.1513) server started (lighttpd/1.4.59)
2022-02-03 22:46:41: configfile.c.1142) WARNING: unknown config-key: alias.url (ignored)
2022-02-04 00:46:43: server.c.1976) server stopped by UID = 0 PID = 1
2022-02-04 00:46:55: server.c.1513) server started (lighttpd/1.4.59)
2022-02-04 00:46:55: configfile.c.1142) WARNING: unknown config-key: alias.url (ignored)
2022-02-04 01:07:33: server.c.1976) server stopped by UID = 0 PID = 1
2022-02-04 01:07:45: server.c.1513) server started (lighttpd/1.4.59)
2022-02-04 01:07:45: configfile.c.1142) WARNING: unknown config-key: alias.url (ignored)
2022-02-04 01:08:30: server.c.1513) server started (lighttpd/1.4.59)
2022-02-04 01:08:30: configfile.c.1142) WARNING: unknown config-key: alias.url (ignored)
2022-02-04 01:14:49: server.c.1976) server stopped by UID = 0 PID = 1
2022-02-04 01:15:02: server.c.1513) server started (lighttpd/1.4.59)
2022-02-04 01:15:02: configfile.c.1142) WARNING: unknown config-key: alias.url (ignored)
2022-02-04 01:35:50: server.c.1976) server stopped by UID = 0 PID = 1
2022-02-04 01:36:02: server.c.1513) server started (lighttpd/1.4.59)
2022-02-04 01:36:02: configfile.c.1142) WARNING: unknown config-key: alias.url (ignored)
2022-02-04 01:42:54: server.c.1976) server stopped by UID = 0 PID = 1
2022-02-04 01:50:52: server.c.1513) server started (lighttpd/1.4.59)
2022-02-04 01:50:52: configfile.c.1142) WARNING: unknown config-key: alias.url (ignored)
2022-02-04 01:57:13: server.c.1976) server stopped by UID = 0 PID = 1
2022-02-04 02:00:44: server.c.1513) server started (lighttpd/1.4.59)
2022-02-04 02:00:44: configfile.c.1142) WARNING: unknown config-key: alias.url (ignored)
2022-02-04 02:02:27: server.c.1976) server stopped by UID = 0 PID = 1
2022-02-04 02:06:15: server.c.1513) server started (lighttpd/1.4.59)
2022-02-04 02:06:15: configfile.c.1142) WARNING: unknown config-key: alias.url (ignored)
2022-02-04 21:19:20: server.c.1976) server stopped by UID = 0 PID = 1

You may test your lighttpd installation for syntactical correctness by running:

lighttpd -t -f /etc/lighttpd/lighttpd.conf

If that comes back with Syntax OK , try restarting it:

sudo service lighttpd restart

In case that fails, please provide the output for:

sudo systemctl status --full --no-pager lighttpd.service

Also, please upload a debug log and post just the token URL that is generated after the log is uploaded by running the following command from the Pi-hole host terminal:

pihole -d

or do it through the Web interface:

Tools > Generate Debug Log

1 Like

syntax check returned:

2022-02-04 21:28:19: configfile.c.1970) source: cat external.conf 2>/dev/null line: 1 pos: 22 parser failed somehow near here: server.port
2022-02-04 21:28:19: configfile.c.1970) source: /etc/lighttpd/lighttpd.conf line: 68 pos: 14 parser failed somehow near here: (EOL)

Full output returned:

● lighttpd.service - Lighttpd Daemon
     Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
     Active: active (running) since Fri 2022-02-04 21:26:46 GMT; 4min 10s ago
    Process: 28724 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, status=0/SUCCESS)
   Main PID: 28731 (lighttpd)
      Tasks: 6 (limit: 4165)
        CPU: 173ms
     CGroup: /system.slice/lighttpd.service
             ├─28731 /usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
             ├─28742 /usr/bin/php-cgi
             ├─28744 /usr/bin/php-cgi
             ├─28745 /usr/bin/php-cgi
             ├─28746 /usr/bin/php-cgi
             └─28747 /usr/bin/php-cgi

Feb 04 21:26:46 montanapi systemd[1]: Starting Lighttpd Daemon...
Feb 04 21:26:46 montanapi lighttpd[28724]: 2022-02-04 21:26:46: configfile.c.1142) WARNING: unknown config-key: alias.url (ignored)
Feb 04 21:26:46 montanapi systemd[1]: Started Lighttpd Daemon.

Pihole debug log token:

https://tricorder.pi-hole.net/EcsfEEnH/

also, the syntax I am using in /external.conf is:

replace  server.port := **** (replace/overwrite earlier value) (since 1.4.46)

Edit: redacted port

The word replace shouldn't be in the config file, just the server.port := 1234.

You don't need to redact the port.

Got it working now, thank you!

1 Like

This is what was tripping me up on my own external.conf edits. Thank you so much for mentioning this!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.