【问题标题】:Backend shuts down on system startup后端在系统启动时关闭
【发布时间】:2023-05-18 07:07:01
【问题描述】:

我在 lighttpd (fastcgi) 上使用 python。当我使用/etc/init.d/lighttpd start 启动服务器时,一切正常。

但现在我已经用update-rc.d lighttpd defaults 60 将它添加到system-v init 中,重启后我在错误日志中有这个东西:

2011-03-24 22:57:01: (log.c.164) server started
2011-03-24 22:57:42: (mod_fastcgi.c.1754) connect failed: Connection refused on unix:/tmp/dvr.sock-0
2011-03-24 22:57:42: (mod_fastcgi.c.3021) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1
2011-03-24 22:57:55: (mod_fastcgi.c.2562) unexpected end-of-file (perhaps the fastcgi process died): pid: 1509 socket: unix:/tmp/dvr.sock-0
2011-03-24 22:57:55: (mod_fastcgi.c.3299) child exited, pid: 1509 status: 1
2011-03-24 22:57:55: (mod_fastcgi.c.3346) response not received, request sent: 858 on socket: unix:/tmp/dvr.sock-0 for /dvr.fcgi?, closing connection

/etc/init.d/lighttpd restart 之后它开始正常工作。

【问题讨论】:

  • 已删除我的答案,(我认为它与 PHP 相关)。但是,几乎相同的情况也适用于 Python。
  • @hek2mgl,我怎么知道你是否删除了它。
  • 哦,我想,你作为 OP 可以看到它。 (我能看到)..将内容贴在pastebin上:pastebin.com/vC9VLKex
  • 谢谢,但我还没有听说过有关 python 的 fastcgi 管理器的任何消息。
  • 你应该,因为 lighthttpd 期待它在 /tmp/dvr.sock-0 上监听。检查这个:electricmonk.nl/docs/apache_fastcgi_python/…

标签: python linux embedded-linux lighttpd init


【解决方案1】:

我忘了说我使用环境变量为我的烧瓶项目选择设置文件。当然这个变量是在/etc/profile 中设置的,这就是我能够从 shell 正确启动项目的原因。

所以在我的情况下,我必须使用 bin-environment 选项将此变量传递给 lighttpd 以使其可用于 fcgi 脚本:

fastcgi.server = (
    "/dvr.fcgi" => (
        "main" => (
            "socket" => "/tmp/dvr.sock",
            "bin-path" => "/var/www/dvr/conf/lighttpd/dvr.fcgi",
            "bin-environment" => (
                    "DVR_SETTINGS" => "/var/www/dvr/settings/production.py"
            ),
            "check-local" => "disable",
            "max-procs" => 1,
        )
    ),
)

【讨论】:

    最近更新 更多