nginx unix domain socket error

jeffgoku asked:

I use fedora 17, and when I setup nginx with uwsgi using unix domain socket, when I place the socket in a directory with proper permission it’s ok, but when I place the socket in the /tmp it will cause nginx error:

connect() to unix:/tmp/MySite.sock failed (2: No such file or directory) while connecting to upstream

The file does exist and has read/write permission for nginx user. But what cause this error, its really drive me crazy, can somebody figure it out.

My answer:


You can’t place sockets intended for interprocess communication in /tmp.

For security reasons, recent versions of Fedora use namespaced temporary directories, meaning every service sees a completely different /tmp and can only see its own files in that directory.

To resolve the issue, place the socket in a different directory, such as /run (formerly known as /var/run).


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.