- 论坛徽章:
- 0
|
本帖最后由 ccz2005 于 2010-06-10 13:01 编辑
看了flask,根据它的文档 进行部署,用lighttpd,fcgi,不成功, 有哪位高手帮帮忙,
官方文档十分简略:
Creating a .fcgi file
First you need to create the FastCGI server file. Let’s call it yourapplication.fcgi:
- #!/usr/bin/python
- from flup.server.fcgi import WSGIServer
- from yourapplication import app
- WSGIServer(app).run()
复制代码 This is enough for Apache to work, however lighttpd and nginx need a socket to communicate with the FastCGI server. For that to work you need to pass the path to the socket to the WSGIServer:
WSGIServer(application, bindAddress='/path/to/fcgi.sock').run()
The path has to be the exact same path you define in the server config.
Save the yourapplication.fcgi file somewhere you will find it again. It makes sense to have that in /var/www/yourapplication or something similar.
Make sure to set the executable bit on that file so that the servers can execute it:
# chmod +x /var/www/yourapplication/yourapplication.fcgi
Configuring lighttpd
A basic FastCGI configuration for lighttpd looks like that:- fastcgi.server = ("/yourapplication" =>
- "yourapplication" => (
- "socket" => "/tmp/yourapplication-fcgi.sock",
- "bin-path" => "/var/www/yourapplication/yourapplication.fcgi",
- "check-local" => "disable"
- )
- )
复制代码 This configuration binds the application to /yourapplication. If you want the application to work in the URL root you have to work around a lighttpd bug with the LighttpdCGIRootFix middleware.
Make sure to apply it only if you are mounting the application the URL root.
上面的lighttpd的配置是有错误的,我在lighttpd上部署不成功 |
|