Nginx + uWSGI 基本配置



我是两者的新手,我必须使用 Emperor 运行 2 个 Django 骨架应用程序(只显示"它有效!"页面),但我想在没有 Emperor 的情况下尝试一下。(为了更好地了解它是如何工作的)

我的 nginx.conf:

# snipped...
server { 
  listen 92; 
  server_name example.com; 
  access_log /home/john/www/example.com/logs/access.log; 
  error_log /home/john/www/example.com/logs/error.log; 
  location / { 
    include uwsgi_params; 
    uwsgi_pass 127.0.0.1:8001; 
  } 
}
# snipped...

我通过以下方式开始uWSGI:

$ uwsgi --ini /home/john/www/example.com/uwsgi.ini

使用 uwsgi.ini是:

[uwsgi]
http = :8001
chdir = /home/john/www/example.com/example
module = example.wsgi
master = True
home = /home/john/Envs/example.com

一旦 uwsgi 和 nginx 运行,我可以访问localhost:8001,但不能localhost:92

我错过了什么?

提前谢谢。

您告诉 uwsgi 进程使用 http 协议为应用程序提供服务。 此功能主要是为了方便开发人员。 相反,您应该告诉它使用 uwsgi 协议:

[uwsgi]
protocol = uwsgi
socket = 127.0.0.1:8001
chdir = /home/john/www/example.com/example
module = example.wsgi
master = True
home = /home/john/Envs/example.com

最新更新