Flask FastCGI
FastCGI是将Flask应用程序部署到像nginix、lighttpd和Cherokee这样的web服务器的另一种选择。
配置FastCGI
首先,您需要创建FastCGI服务器文件。让我们称之为yourapplication.fcgi。
nginx 和旧版本的 lighttpd 需要显式传递一个 socket 来与 FastCGI 服务器通信。为了让它工作,你需要将 socket 的路径传递给 WSGIServer 。
配置Apache
对于基本的Apache部署,你的 .fcgi 文件将出现在你的应用程序URL中,例如 example.com/yourapplication.fcgi/hello/ 。有几种方法可以配置你的应用程序,使得 yourapplication.fcgi 不出现在URL中。
配置lighttpd
基本配置 lighttpd 如下所示 –
记得启用 FastCGI ,别名和重写模块。此配置将应用程序绑定到 /yourapplication 。