且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Nginx 找不到 Unicorn 的 unix socket 文件(没有这样的文件或目录)

更新时间:2022-06-23 05:28:46

经过几个小时和总共 3 杯啤酒后,我设法找出了问题所在.经过数小时的挖掘,我终于遇到了这个服务器故障答案

After many hours and a grand total of 3 beers, I've managed to figure out the problem. After hours of digging, I finally came across this Server Fault answer

通俗地说,在 /tmp(或我发现的 /var/tmp)中创建文件的程序似乎是唯一能够查看该目录中的文件.Unicorn 正在创建 UNIX 套接字文件,但是 Nginx 看不到它.

In layman terms, it appears that programs that create files in /tmp (or /var/tmp as I have discovered) are the only programs that are able to see the files in that directory. Unicorn was creating the UNIX socket file, however Nginx could not see it.

我采用的解决方案是让 Unicorn 在 /var/sockets 中创建套接字.

The solution I have employed is to have Unicorn create sockets in /var/sockets.