Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

nginx

django

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.

like image 670
shellbye Avatar asked Apr 18 '14 05:04

shellbye


People also ask

What is WSGI nginx?

Published: 16. Nginx is “a web server which can also be used as a reverse proxy, load balancer, mail proxy and HTTP cache”. uWSGI is an implementation of the WSGI spec, which describes how a web server should communicate with a web app, which makes uWSGI also a type of web server.

What does uWSGI stand for?

uWSGI (source code), pronounced "mu wiz gee", is a Web Server Gateway Interface (WSGI) server implementation that is typically used to run Python web applications.

What is the difference between uWSGI and WSGI?

uWSGI is a software application that "aims at developing a full stack for building hosting services". It is named after the Web Server Gateway Interface (WSGI), which was the first plugin supported by the project. uwsgi (all lowercase) is the native binary protocol that uWSGI uses to communicate with other servers.

What is uWSGI Django?

uWSGI is a fast, self-healing and developer/sysadmin-friendly application container server coded in pure C. See also. The uWSGI docs offer a tutorial covering Django, nginx, and uWSGI (one possible deployment setup of many). The docs below are focused on how to integrate Django with uWSGI.


Video Answer


1 Answers

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.

like image 172
naiquevin Avatar answered Oct 01 '22 14:10

naiquevin