简体   繁体   中英

Backend shuts down on system startup

I use python on lighttpd (fastcgi). When I start server with /etc/init.d/lighttpd start everything works fine.

But now I've added it to system-v init with update-rc.d lighttpd defaults 60 and after reboot I have this thing in error logs:

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

After /etc/init.d/lighttpd restart it starts working properly.

I forgot to say that I used environment variable to choose settings file for my flask project. Of course this variable was set in /etc/profile that's why I was able to properly start project from shell.

So in my case I had to pass this variable to lighttpd using bin-environment option to make it available for fcgi script:

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,
        )
    ),
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM