简体   繁体   中英

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

I followed this doc , and almost everything went well untill "mysite.sock" occurred. 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.

I am not an expert in this area but I have deployed Django using uWSGI on Nginx with this method. A socket file represents a Unix socket. In this case, uWSGI creates it and it will be through this socket that uWSGI and Nginx will talk to each other.

The " Concept " section of the link you provided talks about it:

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

The first part of the tutorial talks about using TCP port socket to achieve the same result. If you have already followed those steps then you should skip the Unix socket part. However, it also mentions that Unix sockets are better due to less overhead .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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