- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我正在我的 Raspberry Pi 上设置一个简单的网络服务器,但我似乎无法正确设置 lighttpd、fastcgi 和 flask。
到目前为止,我已经经历了几次 /etc/lighttpd/lighttpd.conf
的迭代,最近的一次是
fastcgi.server = ("/test" =>
"test" => (
"socket" => "/tmp/test-fcgi.sock",
"bin-path" => "/var/www/py/test.fcgi",
"check-local" => "disable"
)
)
在 /etc/init.d/lighttpd start
上出现错误。第一行看起来不对,所以我在粗箭头后面加了一组括号:
fastcgi.server = ("/test" => (
...
))
这并没有吐出错误,但是当我尝试连接时,我在 Chrome 中得到了 ERR_CONNECTION_REFUSED
。然后我尝试删除 "/test"=>
,但出现了同样的问题。我还尝试了 this question, 中显示的配置并且出现了同样的问题。
在 /var/www/py/test.fgci
中:
#!/usr/bin/python
from flup.server.fcgi import WSGIServer
from test import app
WSGIServer(app, bindAddress="/tmp/test-fcgi.sock").run()
在 /var/www/py/test.py
中:
from flask import Flask
app = Flask(__name__)
@app.route("/test")
def hello():
return "<h1 style='color:red'>☭ hello, comrade ☭</h1>"
当我用 /etc/init.d/lighttpd start
启动时,当前的 lighttpd.conf
失败。
最佳答案
我无法在 Python 部分真正帮助您,因为它超出了我的技能范围,但是当将 php 作为 fcgi 服务器运行时,我会像下面这样使用 lighttpd.conf。
fastcgi.server += ( ".php" =>
((
"host" => "127.0.0.1",
"port" => "9000",
"broken-scriptfilename" => "enable"
))
)
所以我假设像下面这样的东西是你需要的 python。
fastcgi.server += ( "/test" =>
((
"socket" => "/tmp/test-fcgi.sock",
"bin-path" => "/var/www/py/test.fcgi",
"check-local" => "disable"
))
)
关于python - FastCGI、Lighttpd 和 Flask,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36272196/
我对 FastCGI 的工作原理有点困惑。我的程序真的只有一个实例在运行,还是有一些神奇的线程在运行?这很重要,因为如果我的数据结构的范围在主循环之外,我需要知道这些数据结构是否需要是线程安全的。 编
FastCGI 很旧,但在某些情况下它似乎仍然是正确的答案。 似乎 Perl/Catalyst Web 应用程序的首选部署是使用 FastCGI。 FastCGI 在 Rails 中很流行,但现在似乎
除了建立 TCP 连接之外,如何检查 FastCGI 服务器是否处于事件状态并正常运行? 我有许多远程、独立的 FastCGI 服务器。我想监控 FastCGI 服务器本身以确保其存活。简单地向 We
我今天在 Cherokee 上设置 Django(使用 SCGI),我注意到 the Django docs假设您可以使用主机/端口组合或套接字在网络服务器和 Django 之间进行通信。 他们在这件
httpd 配置文件可以有多少个 fastcgi 处理程序?我想设置 httpd 服务器来服务器在不同 tcp 套接字上运行的多个 fastcgi 程序。例如:http://uwsgi-docs.re
我已经将 Web 服务器配置为通过命名管道使用“远程”fastCGI 应用程序(它实际上位于同一台 Windows 主机上)。我现在正试图找出如何启动 fastCGI 应用程序以使用此管道,但我不确定
我正在写 FastCGI wire protocol implementation in C (还导出了一个用于编写应用程序服务器的更高级别的 C++ 接口(interface))并且我已经完成了足够
我理解 FastCGI 在性能方面优于其他网关接口(interface)的目的。但是,如果实现 FastCGI 的库已经不得不通过艰苦的措施来实现安全高效的 TCP 服务,为什么不直接将应用程序编写为
我正在使用 nginx、factcgi 和 spawn-fcgi 并试图让它工作。 我按如下方式启动 spawn-fcgi: g++ rtbTimeSeries.cpp -o forecast.fcg
我有一个 FastCGI Perl 网络应用程序(使用 CGI::Fast 编写,但这应该无关紧要),我想在FastCGI 模式下进行测试。 我可以使用什么 Perl 模块来运行 FastCGI 应用
谁能提供我一步一步的方式,我可以运行apache2在快速-cgi上ubuntu 22.10,我尝试了几件事,但我得到一个空白页或错误,我是在新安装的Apache2服务器实例。。Thnx!。尝试了很多东
我正在构建一个 C++ API,我想将其作为 Web 服务提供。我正在考虑使用 REST API,并决定使用 FastCGI 或 FastCGI C++ 在 C++ API 和 Web 服务器之间进行
我试图添加 try_files 来检查 php 文件是否存在,但它给了我错误。 "try_files" directive is duplicate in /etc/nginx/snippets/fa
我计划在Rebol(目前在Apache 2上为CGI)中编写一个相当不错的Web应用程序,但是最初的性能测试却非常令人沮丧。在应用程序上运行apache基准测试时,我仅得到4-5个请求/秒。我想知道其
我正在使用 web.py、spawn_fcgi 和 nginx 在 Python 中编写 Web 应用程序。 假设我在 nginx 中有这个配置块: location / { include
我正在实现一个 fastcgi 应用程序,在阅读了 fastCGI 规范后,我发现了一个名为“请求多路复用”的功能。它让我想起了 Adobe RTMP 多路复用在协议(protocol)是专有和封
我一直在尝试实现Web服务器网关(出于娱乐和教育目的),并且对于前叉模型,我对FastCGI/SCGI背后的核心体系结构有一些疑问。 FastCGI/SCGI实现如何处理前叉场景中的通信? AFAIK
我编写了一个简单的 Perl 脚本,通过 Apache 上的 fastCGI 运行该脚本。该应用程序加载一组 XML 数据文件,这些文件用于根据传入请求的查询参数查找值。据我了解,如果我想增加应用程序
我正在尝试使用FastCGI(和restcgi)开发简单的RESTful api。当我尝试实现 POST 方法时,我注意到输入流(表示请求正文)是错误的。我做了一个小测试,看起来当我尝试读取流时,只收
我正在运行 2 个不同的 php 版本。它们运行良好,但没有连接到 mysql,我不知道为什么。它们应该是,但我不知道如何强制它们连接 mysql。 php版本是5.3.27和5.4.31如果您需要更
我是一名优秀的程序员,十分优秀!