uwsgi无法在云服务器上运行

时间:2015-05-07 04:11:15

标签: python uwsgi

我在云端服务器上安装了uwsgi,测试时我编写了一个python脚本来测试它,如下所示:

# test.py
def application(env, start_response):
    start_response('200 OK', [('Content-Type','text/html')])
    return [b"Hello World"] # python3

然后按如下方式运行:

uwsgi --http :8001 --wsgi-file test.py

我得到一些这样的信息:

pcre jit disabled
detected number of CPU cores: 1
current working directory: /root
detected binary path: /root/.pyenv/versions/2.7.6/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** WARNING: you are running uWSGI without its master process manager ***
your processes number limit is 7840
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on :8001 fd 4
spawned uWSGI http 1 (pid: 8524)
uwsgi socket 0 bound to TCP address 127.0.0.1:53307 (port auto-assigned) fd 3
Python version: 2.7.6 (default, May  6 2015, 18:35:37)  [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x1108510
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72768 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0x1108510 pid: 8491 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 8491, cores: 1)

但是当我在浏览器上键入IP地址和端口时,它无法回显" Hello World"。

1 个答案:

答案 0 :(得分:1)

检查防火墙规则。像8001这样的任意端口往往禁止从外部访问开箱即用。应该可以从服务器上的命令行工作得很好,例如$ curl localhost:8001