如果我有一个 fcgi 服务器正在运行并使用浏览器访问它,会发生什么?

发布于 2024-09-29 16:42:57 字数 639 浏览 0 评论 0原文

我有以下设置 - 当我在浏览器中访问服务器时没有得到任何响应。

我应该期待一些吗?这是测试设置,使用 python &慌乱。

#test.py

def myapp(environ, start_response):
  start_response('200 OK', [('Content-Type', 'text/plain')])
  return ['abc\n']

import os
os.environ['FCGI_WEB_SERVER_ADDRS']="127.0.0.1:8000"
from flup.server.fcgi import WSGIServer
WSGIServer(myapp, bindAddress=('127.0.0.1',8000)).run()

python test.py

lynx http://127.0.0.1:8000

unexpected network read error; connection aborted

如果我注释掉操作系统内容并重新启动服务器:

lynx http://127.0.0.1:8000

HTTP request sent; waiting for response.

并且没有任何返回。

I have the following setup - and don't get any response when I visit the server in a browser.

Should I expect some? Here's the test setup, using python & flup.

#test.py

def myapp(environ, start_response):
  start_response('200 OK', [('Content-Type', 'text/plain')])
  return ['abc\n']

import os
os.environ['FCGI_WEB_SERVER_ADDRS']="127.0.0.1:8000"
from flup.server.fcgi import WSGIServer
WSGIServer(myapp, bindAddress=('127.0.0.1',8000)).run()

python test.py

lynx http://127.0.0.1:8000

unexpected network read error; connection aborted

if i comment out the OS stuff and restart server:

lynx http://127.0.0.1:8000

HTTP request sent; waiting for response.

and nothing ever returns.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

铃予 2024-10-06 16:42:57

您的 FCGI 服务器不支持 HTTP。您需要一个可以使用 FCGI 的 HTTP 代理。你可以运行像 nginx 这样的东西,它确实支持 HTTP,并且可以传递到 FCGI。

http://wiki.nginx.org/NginxFcgiExample

Your FCGI server does not speak HTTP. You need an HTTP proxy that can speak FCGI. You can run something like nginx that does speak HTTP and can pass through to FCGI.

http://wiki.nginx.org/NginxFcgiExample

弃爱 2024-10-06 16:42:57

您可以使用 telnet 连接到 fcgi 服务器,但是(至少在 Windows 上)您将看不到任何内容,因为服务器希望您首先发送一些二进制消息。
因此,输入几个字符后,服务器会断开连接。
如果 telnet 根本无法连接,这可能意味着防火墙或地址:端口绑定问题(即您连接到的地址与服务器绑定的地址错误)。

You can connect with telnet to fcgi server, but (at least on Windows) you will not see anything, because the server expects you to send some binary messages first.
So after a couple of characters entered server drops the connection.
In case telnet does not connect at all, this may mean either firewall or address:port binding problem (that is you are either connecting to the wrong address than your server is binded to).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文