我在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
之后它开始正常工作。
答案 0 :(得分: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,
)
),
)