django - 在 django + nginx + wsgi 中, "mysite.sock"是什么

标签 django nginx

我关注了this doc ,几乎一切顺利,直到“mysite.sock”出现。它是这样发生的:

server unix:///path/to/your/mysite/mysite.sock; # for a file socket
# server 127.0.0.1:8001; # for a web port socket (we'll use this first)

这个文档没有提到任何关于“mysite.sock”的内容,经过一天的搜索,我什么也没找到。

最佳答案

我不是这方面的专家,但我已经通过这种方法在 Nginx 上使用 uWSGI 部署了 Django。一个套接字文件代表一个 Unix 套接字。在这种情况下,uWSGI 创建它,uWSGI 和 Nginx 将通过这个套接字相互通信。

您提供的链接的“Concept”部分讨论了它:

uWSGI is a WSGI implementation. In this tutorial we will set up uWSGI so that it creates a Unix socket, and serves responses to the web server via the WSGI protocol. At the end, our complete stack of components will look like this:

the web client <-> the web server <-> the socket <-> uwsgi <-> Django



教程的第一部分讨论了使用 TCP 端口套接字来实现相同的结果。如果您已经遵循了这些步骤,那么您应该跳过 Unix 套接字部分。但是,它也提到Unix sockets are better due to less overhead .

关于django - 在 django + nginx + wsgi 中, "mysite.sock"是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23148082/

相关文章:

django - 装饰器失败时显示错误消息

python - mysql中django queryset extra()中的日期格式

nginx - php5-fpm + nginx + Google bot = 由对等方重置连接

javascript - NginX 代理 Nodejs/Express - 静态文件上的 404

nginx - CentOS 5 安装NGINX "No package found"错误

ssl - 为 ssl 开放 443 端口

python - 来自 Django 的开发服务器端口绑定(bind)错误的 ptvsd 远程调试

django - 使用collectstatic编辑Amazon S3上的文件

django - 如何让 Django 根据 HTTP 请求中的 "Host" header 确定要使用哪个 Site 对象?

security - nginx - 限制对 https 的直接 URL 访问,但可以从 http 重定向