/ / Nginx、django、gunicorn、ubuntu 14.04(13:許可が拒否されました)上流への接続中 - Python、django、unix、ubuntu、nginx

アップストリームに接続している間、Nginx、django、gunicorn、ubuntu 14.04(13:Permission denied) - Python、django、unix、ubuntu、nginx

私は私のところで働いています django プロジェクト nginx そして gunicorn、それはここに言ったように:

https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-14-04

私のサイトはローカルで動作しますが、起動すると nginx そして gunicorn 私が持っていたサーバー

502ゲートウェイエラーです。

OSは UBUNTU 14.04

私は自分のプロジェクトを仕事にしようとしており、すべてをrootとして再インストールしようとしています(私はその悪いことを知っています) - 同じ間違いです。

ここに私の "error.log"があります:

2016/04/20 20:15:10 [crit] 10119#0:* 1 connect()に
unix:/root/myproject/myproject.sock failed(13:許可が拒否されました) 上流に接続している間、クライアント:46.164.23

私がcomandを走らせるとき、nginx":

  nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

私のgunicorn.conf

description "Gunicorn application server handling myproject" start on runlevel [2345] stop on runlevel [!2345] respawn setuid root setgid www-data chdir /root/myproject exec myprojectenv/bin/gunicorn --workers 3 --bind unix:/root/myproject/myproject.sock myproject.wsgi:application

それは私の "/ etc / nginx / sites-available / myproject"

server {
listen 80;
server_name         www.mysite.ru;

error_log /nginx_error.log;

location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /root/myproject;
}

location / {
include proxy_params;
proxy_pass http://unix:/root/myproject/myproject.sock;
}

}

私はあなたの助けを非常に感謝します!

回答:

回答№1は1
proxy_pass http://unix:/root/myproject/myproject.sock;

ソケットはスーパーユーザーのホームフォルダにあります。 / var / log / gunicorn /は、あなたのnginxユーザーを含む他のすべてのユーザーにはほとんどアクセスできません。

また、あなたはgunicornをrootとして実行していますか?お勧めしません。

setuid root

他のユーザーをここで使用してください。


回答№2の場合は0

私はあなたのnginxエラーログによると、ポート80を使用していくつかの他のプロセスがあると思います。

そのプロセスが何であるか把握し、不要な場合はそれを強制終了するか、別のポートを使用する必要があります。