flask, lighttpd with fastcgi can't get it to work
Posted
by
kurojishi
on Server Fault
See other posts from Server Fault
or by kurojishi
Published on 2013-07-03T00:27:40Z
Indexed on
2013/07/03
5:08 UTC
Read the original article
Hit count: 752
i'm tring to deploy a simple flask script to a lighttpd server with fastcgi.
this is the configuration file for lighttpd builded using the flask documentation http://flask.pocoo.org/docs/deploying/fastcgi/#configuring-lighttpd
server.modules = (
"mod_access",
"mod_alias",
"mod_compress",
"mod_redirect",
"mod_rewrite",
"mod_fastcgi",
)
server.document-root = "/var/www"
server.upload-dirs = ( "/var/cache/lighttpd/uploads" )
server.errorlog = "/var/log/lighttpd/error.log"
server.pid-file = "/var/run/lighttpd.pid"
server.username = "www-data"
server.groupname = "www-data"
index-file.names = ( "index.php", "index.html",
"index.htm", "default.htm",
" index.lighttpd.html" )
url.access-deny = ( "~", ".inc" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
var.home_dir = "/var/lib/lighttpd"
var.socket_dir = home_dir + "sockets/"
## Use ipv6 if available
#include_shell "/usr/share/lighttpd/use-ipv6.pl"
dir-listing.encoding = "utf-8"
server.dir-listing = "enable"
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype = ( "application/x-javascript", "text/css", "text/html", "text/plain" )
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
fastcgi.server = ("weibo/callback.fcgi" =>
((
"socket" => "/tmp/weibocrawler-fcgi.sock",
"bin-path" => "/var/www/weibo/callback.fcgi",
"check-local" => "disable",
"max-procs" => 1
))
)
url.rewrite-once = (
"^(/weibo($|/.*))$" => "$1",
"^(/.*)$" => "weibo/callback.fcgi$1"
and this is the script i'm tring to run:
#!/home/nrl/kuro/weiboenv/bin/python
from flup.server.fcgi import WSGIServer
from callback import app
if __name__ == '__main__':
WSGIServer(application, bindAddress='/tmp/weibocrawler-fcgi.sock').run()
but i have this error testing the configuration file i get this error: 2013-07-02 17:15:42: (configfile.c.912) source: lighttpd.conf.new line: 52 pos: 1 parser failed somehow near here: weibo/callback.fcgi$1
when i remove the urlrewrite i get these errors in the log even if the daemon start:
2013-07-02 16:25:53: (log.c.166) server started
2013-07-02 16:25:53: (mod_fastcgi.c.1104) the fastcgi-backend fcgi.py failed to start:
2013-07-02 16:25:53: (mod_fastcgi.c.1108) child exited with status 2 fcgi.py
2013-07-02 16:25:53: (mod_fastcgi.c.1111) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.
If this is PHP on Gentoo, add 'fastcgi' to the USE flags.
2013-07-02 16:25:53: (mod_fastcgi.c.1399) [ERROR]: spawning fcgi failed.
2013-07-02 16:25:53: (server.c.938) Configuration of plugins failed. Going down.
© Server Fault or respective owner