【问题标题】:Nginx and Unicorn user permissions for socket套接字的 Nginx 和 Unicorn 用户权限
【发布时间】:2014-03-29 14:05:43
【问题描述】:

Nginx 有一个明确定义的方式来设置进程运行的对象,就像在 conf 文件中一样:

user nobody nogroup;

(虽然作为一个附带问题,我想知道为什么需要组?如果您以用户身份运行该过程,则根据定义该组必须是该用户所属的组,您如何同时定义用户和组?)

但独角兽似乎没有这个能力。结果,在我的提供商的 VPS 中,我以 root 身份登录,我启动 nginx(以用户 nginx,组 web 运行),然后我启动 unicorn(以 root 身份启动,因为我以 root 身份登录)。 Unicorn 创建了一个 root 拥有的套接字,然后 nginx 无法从中读取。如何让 unicorn 以与 nginx 相同的安全组中的用户 unicorn 运行,以便 nginx 可以读取套接字?

这是ubuntu 12.04 64bit,unicorn v4.8.2,nginx版本:nginx/1.4.6

错误如下:

unix:/etc/sockets/.unicorn.sock failed (2: No such file or directory) while connecting to upstream, client: 24.7.100.227, server: _, request: "GET / HTTP/1.1", upstream: "http://unix:/etc/sockets/.unicorn.sock:/", host: "xx.xx.xx.xxx"

【问题讨论】:

    标签: ruby-on-rails ruby nginx unicorn


    【解决方案1】:

    啊,我想通了。它实际上是不必要的。两个进程都作为其主进程的 root 运行。即使您使用用户参数配置 nginx,主进程也会以 root 身份运行,这是与套接字交互的那个。所以我的问题实际上是其他问题(独角兽 conf 文件中的错字)

    【讨论】:

      猜你喜欢
      • 2014-03-31
      • 2012-04-26
      • 2014-04-07
      • 1970-01-01
      • 2014-12-02
      • 1970-01-01
      • 2017-05-30
      • 2016-05-21
      • 1970-01-01
      相关资源
      最近更新 更多