开发者

If I have an fcgi server running and visit it with a browser, what should happen?

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 t开发者_C百科he 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.


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


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜