如果我有一个 fcgi 服务器正在运行并使用浏览器访问它,会发生什么?
我有以下设置 - 当我在浏览器中访问服务器时没有得到任何响应。
我应该期待一些吗?这是测试设置,使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您的 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
您可以使用 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).