服务器安装好 lighttpd 并配置好各种配置,比如SSL证书、alias等等,手工重启lighttpd 后会正常启动并运行,但在未知情况下,服务器会自动重启,并且启动失败,失败提示为:
● lighttpd.service - Lighttpd Daemon
Loaded: loaded (/lib/systemd/system/lighttpd.service; enabled; vendor preset: enabled)
Active: failed (Result: signal) since Tue 2023-11-07 14:46:20 CST; 7min ago
Process: 17461 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf (code=exited, sta>
Process: 17466 ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf (code=killed, signal=>
Main PID: 17466 (code=killed, signal=SEGV)
CPU: 415ms
Nov 07 14:46:20 AAAA systemd[1]: lighttpd.service: Scheduled restart job, restart counter is at 7.
Nov 07 14:46:20 AAAA systemd[1]: Stopped Lighttpd Daemon.
Nov 07 14:46:20 AAAA systemd[1]: lighttpd.service: Start request repeated too quickly.
Nov 07 14:46:20 AAAA systemd[1]: lighttpd.service: Failed with result 'signal'.
Nov 07 14:46:20 AAAA systemd[1]: Failed to start Lighttpd Daemon.
经过几天的使用发现,这种重启是不定时的,在错误日志中发现有下列的错误信息:
2023-11-07 10:58:11: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 10:58:11: mod_openssl.c.3095) SSL: 1 error:1408F10B:SSL routines:ssl3_get_record:wrong versio
n number
2023-11-07 10:58:37: connections.c.750) invalid request-line -> sending Status 400
2023-11-07 10:58:37: connections.c.750) invalid request-line -> sending Status 400
2023-11-07 11:02:44: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 11:02:45: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 11:03:22: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 11:03:23: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 11:04:11: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 11:04:48: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 11:04:49: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 11:05:38: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 11:05:38: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 11:36:27: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 12:19:18: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 12:19:19: mod_openssl.c.3095) SSL: 1 error:1408F10B:SSL routines:ssl3_get_record:wrong versio
n number
2023-11-07 12:28:54: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 12:28:58: mod_openssl.c.3095) SSL: 1 error:1408F09C:SSL routines:ssl3_get_record:http request
2023-11-07 12:29:59: connections.c.750) invalid request-line -> sending Status 400
2023-11-07 12:55:24: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 13:36:24: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 13:44:09: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 13:44:10: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 13:44:11: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 13:44:11: mod_openssl.c.3095) SSL: 1 error:14209102:SSL routines:tls_early_post_process_clien
t_hello:unsupported protocol
2023-11-07 13:44:12: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 13:44:12: mod_openssl.c.3095) SSL: 1 error:142090C1:SSL routines:tls_early_post_process_clien
t_hello:no shared cipher
2023-11-07 13:44:13: mod_openssl.c.3095) SSL: 1 error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad
key share
2023-11-07 13:44:14: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 13:44:14: mod_openssl.c.3095) SSL: 1 error:14209102:SSL routines:tls_early_post_process_clien
t_hello:unsupported protocol
2023-11-07 14:35:35: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 14:35:38: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 14:36:46: mod_openssl.c.3095) SSL: 1 error:1408F09C:SSL routines:ssl3_get_record:http request
2023-11-07 14:37:52: mod_openssl.c.3095) SSL: 1 error:1408F10B:SSL routines:ssl3_get_record:wrong versio
n number
2023-11-07 14:42:20: mod_openssl.c.3095) SSL: 1 error:1408F09C:SSL routines:ssl3_get_record:http request
2023-11-07 14:45:43: mod_openssl.c.3095) SSL: 1 error:1408F09C:SSL routines:ssl3_get_record:http request
2023-11-07 14:46:12: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 14:46:13: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 14:46:16: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 14:46:17: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 14:46:18: server.c.1513) server started (lighttpd/1.4.59)
2023-11-07 14:46:19: mod_openssl.c.3095) SSL: 1 error:14209102:SSL routines:tls_early_post_process_clien
t_hello:unsupported protocol
其中充斥着大量的 SSL错误信息,这在从前是不曾出现过的,实在找不到解决原因,只能按照网上其它人的办法按个试一下:
其中一个是要安装 gamin 这个软件包,至于原因作者也不清楚,原文如下:
Turns out this is a bug that's been around for years, if this issue is anything to go by. Several users in the comments of that bug claim that installing the gamin package solves this issue.
I haven't done any extensive testing, but it seems to be a solution. Running sudo apt install --reinstall lighttpd normally shows that it fails to start lighttpd. However, after installing gamin, the output looks like it normally would for any successful package installation. systemctl status also shows lighttpd as active and running now.
Note that the package libfam0 gets removed when installing gamin. I don't know what it's for, or what packages may depend on it, so keep that in mind, unless someone else can comment as to its usefulness and necessity.
第二个是说把 lighttpd 的 日志目录所属权和权限更改一下,个人觉得不是这个原因:
chown -R www-data:www-data /var/log/lighttpd/
chmod 755 /var/log/lighttpd
原文如下:
I solved with this:
chown -R www-data:www-data /var/log/lighttpd/
Worked for me. Might also be helpful to chmod 755 /var/log/lighttpd in conjunction with the above command
刚刚安装完,以观后效。如果本文不再更新,就证明确实是 gamin 软件包或日志目录权限的问题!