Nginx cannot find unix socket file with Unicorn (no such file or directory)

后端 未结 2 1225
隐瞒了意图╮
隐瞒了意图╮ 2020-12-12 17:23

I am deploying a Rails 4 app to a Fedora 19 x64 server using Nginx and Unicorn. The problem is that I get an error when visiting the address: \"We\'re sorry, but something w

相关标签:
2条回答
  • 2020-12-12 17:37

    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

    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.

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

    0 讨论(0)
  • 2020-12-12 18:01

    I suddenly had a similar situation after changing nginx to use a systemd startup service based on their template.

    It ends up that the problem was with PrivateTmp=true, which makes it so that nginx was unable to access the socket file created by gunicorn. Once I changed this to PrivateTmp=false the error resolved.

    0 讨论(0)
提交回复
热议问题