/ / Nginx, Django, Gunicorn, Ubuntu 14.04 (13: Genehmigung verweigert), während eine Verbindung zum Upstream hergestellt wird - Python, Django, Unix, Ubuntu, Nginx

Nginx, Django, Gunicorn, Ubuntu 14.04 (13: Berechtigung verweigert) beim Verbinden mit Upstream - Python, Django, Unix, Ubuntu, Nginx

Ich arbeite an meinem django Projekt mit nginx und gunicornwie hier gesagt:

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

Meine Site funktioniert lokal, aber wenn ich anfange nginx und gunicorn Server hatte ich

502 Fehler beim fehlerhaften Gateway.

OS ist UBUNTU 14.04

Ich versuche, mein Projekt zum Laufen zu bringen und alles als root neu zu installieren (ich weiß, dass es schlecht ist) - der gleiche Fehler.

Hier ist mein "error.log":

20.04.2016 20:15:10 [krit] 10119 # 0: * 1 connect () mit
unix: /root/myproject/myproject.sock fehlgeschlagen beim Verbinden mit dem Upstream-Client: 46.164.23

Wenn ich Kommandant bin "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()

Meine 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

Das ist mein "/ etc / nginx / sites-available / meinprojekt"

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;
}

}

Ich werde Ihre Hilfe sehr schätzen !!!

Antworten:

1 für die Antwort № 1
proxy_pass http://unix:/root/myproject/myproject.sock;

Der Socket befindet sich im Home-Ordner des Superuser. Das ist für alle anderen Benutzer, einschließlich Ihrer Nginx-Benutzer, nahezu unzugänglich.

Sehen Sie auch, dass Sie Gunicorn als Root ausführen? Nicht empfohlen.

setuid root

Bitte verwenden Sie hier einen anderen Benutzer.


0 für die Antwort № 2

Ich denke, Sie haben einen anderen Prozess, der Port 80 verwendet, entsprechend Ihrem Nginx-Fehlerprotokoll.

Sie müssen herausfinden, was dieser Prozess ist, und ihn beenden, wenn er nicht benötigt wird.