Greetings. I configure a Django-site on VPS. I do it according to the instructions. But in the article they start talking about using mysite.sock, but I don’t have it and where it comes from, too, I don’t find any information, even on the Internet. Can anyone come across and know what it is about? Thank.
2 answers
This is the socket that uwsgi creates for nginx. In the nginx config you must specify the path to this file (do not forget about the rights to the socket itself). The socket itself is created and specified in mysite_uwsgi.ini (based on the article). That is, in mysite_uwsgi.ini you specify where to create a socket, and then in the nginx config file you specify its location. If everything is correct, then when uwsgi and nginx are started, the first will create a socket, the second will pull requests into it, and the first will send them to Django the project.
- Thanks for the answer! Immediately it became more clear what is happening. Indeed, a socket is created by itself when uwsgi is started. And while I was writing this comment, the site was up!)) In general, I was stupid and created a socket myself, pointed it out to nginx and uwsgi, once I changed the rights, I figured something out, restarted, and then I changed the rights to that old socket. And when uwsgi is stopped, the socket is deleted, and then a new one is created with default rights. In general, thank you very much for your help! - Genome
- oneAnd yet, it seems that the user under which I configured is not in the right group or something like that, until I figure it out, in general, he didn’t have enough 664 permissions, so it still worked, because I pointed out 666 to it to the socket. - Genome
judging by the name of the file and the context of the question, this is a unix domain socket ( uds ) .
it serves for interprocess communication, and in your case you just need to specify both processes ( nginx and something on the python ) with the same name.
for example, /var/run/mysite.sock
As a rule, you do not need to create this “ special type ” file yourself: it is created by one of the interacting processes (in your case, “something in python”) when you start it.
You can read more about uds in the corresponding man page:
$ man 7 unix