简体   繁体   English

在 django + nginx + wsgi 中,什么是“mysite.sock”

[英]In django + nginx + wsgi, what is a “mysite.sock”

I followed this doc , and almost everything went well untill "mysite.sock" occurred.我跟着这个文档,几乎一切顺利,直到“mysite.sock”发生。 It occurred like this:它是这样发生的:

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)

This doc did not mention anything about the "mysite.sock" and after one day's searching, I found nothing.该文档没有提及有关“mysite.sock”的任何内容,经过一天的搜索,我一无所获。

I am not an expert in this area but I have deployed Django using uWSGI on Nginx with this method.我不是这方面的专家,但我已经通过这种方法在 Nginx 上使用 uWSGI 部署了 Django。 A socket file represents a Unix socket.一个套接字文件代表一个 Unix 套接字。 In this case, uWSGI creates it and it will be through this socket that uWSGI and Nginx will talk to each other.在这种情况下,uWSGI 创建它,并且 uWSGI 和 Nginx 将通过这个套接字相互通信。

The " Concept " section of the link you provided talks about it:您提供的链接的“ 概念”部分对此进行了讨论:

uWSGI is a WSGI implementation. uWSGI 是一个 WSGI 实现。 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.在本教程中,我们将设置 uWSGI,以便它创建一个 Unix 套接字,并通过 WSGI 协议向 Web 服务器提供响应。 At the end, our complete stack of components will look like this:最后,我们完整的组件堆栈将如下所示:

the web client <-> the web server <-> the socket <-> uwsgi <-> Django Web 客户端 <-> Web 服务器 <-> 套接字 <-> uwsgi <-> Django

The first part of the tutorial talks about using TCP port socket to achieve the same result.本教程的第一部分讨论了使用 TCP 端口套接字来实现相同的结果。 If you have already followed those steps then you should skip the Unix socket part.如果您已经遵循了这些步骤,那么您应该跳过 Unix 套接字部分。 However, it also mentions that Unix sockets are better due to less overhead .但是,它还提到Unix 套接字由于开销较少而更好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM