gpt4 book ai didi

django - Nginx + uWSGI 基本配置

转载 作者:行者123 更新时间:2023-12-04 19:22:17 25 4
gpt4 key购买 nike

我对两者都是新手,我必须使用 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 协议(protocol)为应用程序提供服务。此功能主要是为了方便开发人员。你应该告诉它使用 uwsgi 协议(protocol):

[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

关于django - Nginx + uWSGI 基本配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11844409/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com