【问题标题】:nginx permission denied while attempting to connect to upstream Ubuntu 14.04 Gunicorn尝试连接到上游 Ubuntu 14.04 Gunicorn 时,nginx 权限被拒绝
【发布时间】:2015-07-14 14:36:05
【问题描述】:

好的。我已经走到了尽头。我有这个工作,然后我不确定这是否只是巧合,但我在服务器上设置了 VNC 并且它停止工作(按照本教程:https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-14-04

我通过 Digital Ocean 获得了一个 Django 项目。我按照他们在此处找到的教程进行操作:https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-14-04

sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

cat /var/log/nginx/error.log
015/05/04 22:03:33 [crit] 6399#0: *3 connect() to unix:/path/to/project.sock failed (13: Permission denied) while connecting to upstream, client: ipaddress, server: myproject.com, request: "GET / HTTP/1.1", upstream: "http://unix:/path/to/project.sock:/", host: "myproject.com"

ls -lh ~/myproject
srwxrwxrwx 1 myusername www-data    0 Apr  1 12:37 myproject.sock

我一直在四处寻找,但我找不到任何与我的问题完全匹配的东西,即使我觉得这只是一个愚蠢的许可事情,以某种方式改变了。

如果上面有什么不够清楚的地方,请让我详细说明。

【问题讨论】:

  • 我的建议是回滚 VNC 并首先使用不太复杂的设置。但是,如果你想保留 VNC,你可能想尝试这种方法来实现:github.com/kanaka/noVNC/wiki/Proxying-with-nginx
  • 说实话,我决定重新启动。该网站在技术上是“活的”,但它真的只适合我。所以我在数据库中没有太多东西,而且都是可以复制的。不过感谢您的链接!
  • 不客气!祝你好运。

标签: django ubuntu nginx gunicorn digital-ocean


【解决方案1】:

我认为你在 nginx conf 文件中的 sock 文件有误:

proxy_pass http://unix:/home/user/myproject/myproject.sock;

如错误日志所示,nginx 尝试打开 /path/to/project.sock 文件。将其更改为 /home/username/myproject/myproject.sock

【讨论】:

  • 对不起。由于间距的原因,我省略了其中的一些行,但错误实际上指向:/home/myuser/myproject/myproject.sock 我的 nginx 配置文件看起来就像那行。
猜你喜欢
  • 2018-09-13
  • 2014-07-19
  • 2022-01-03
  • 2017-10-18
  • 2015-07-04
  • 2016-05-12
  • 2014-03-16
  • 2013-11-03
  • 2016-08-14
相关资源
最近更新 更多