Configuration d'un site django avec gunicorn & nginx Je peux exécutez-le avec gunicorn --bind 0.0.0.0:8000 myproject.wsgi:application
cependant l'instance de gunicorn avec nginx échoue avec une erreur ne peut pas se relier au dossier de chaussette (et ne le crée pas également).Gunicorn & django: connect() à unix: /home/ubuntu/webapps/kenyabuzz/kb.sock a échoué (2: aucun fichier ou répertoire) lors de la connexion à l'amont
Le journal d'erreur est:
2017/02/01 11:43:47 [crit] 30225#30225: *9 connect() to unix:/home/ubuntu/webapps/kenyabuzz/kb.sock failed (2: No such file or directory) while connecting to upstream, client: 197.232.12.165, server: kenyabuzz.nation.news, request: "GET/HTTP/1.1", upstream: "http://unix:/home/ubuntu/webapps/kenyabuzz/kb.sock:/", host: "kenyabuzz.nation.news"
paramètres pertinents sont /etc/init/gunicorn.conf
description "Gunicorn application server handling all projects"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
setuid user
setgid www-data
chdir /home/ubuntu/webapps/kenyabuzz
exec /home/ubuntu/webapps/djangoenv/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/webapps/kenyabuzz/kb.sock kb.wsgi:application
et /etc/systemd/system/gunicorn.service
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=ubuntu
Group=nginx
WorkingDirectory=/home/ubuntu/webapps/kenyabuzz
ExecStart=/home/ubuntu/webapps/djangoenv/bin/gunicorn --workers 3 --bind unix:/home/ubuntu/webapps/kenyabuzz/kb.sock kb.wsgi:application
[Install]
WantedBy=multi-user.target
fichier nginx conf
server {
listen 80;
server_name kenyabuzz.nation.news;
# Django media
location /media {
alias /home/ubuntu/webapps/kenyabuzz/kb/media; # your Django project's media files - amend as required
}
location /static {
alias /home/ubuntu/webapps/kenyabuzz/kb/static; # your Django project's static files - amend as required
}
location /favicon.ico {
alias /home/ubuntu/webapps/kenyabuzz/kb/static/kb/favicon.ico; # favicon
}
location/{
include proxy_params;
proxy_pass http://unix:/home/ubuntu/webapps/kenyabuzz/kb.sock;
}
}
MISE À JOUR
d'état gunicorn
[email protected]:~$ sudo systemctl status gunicorn
● gunicorn.service - gunicorn daemon
Loaded: loaded (/etc/systemd/system/gunicorn.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2017-02-01 11:26:01 UTC; 21h ago
Process: 30211 ExecStart=/home/ubuntu/webapps/djangoenv/bin/gunicorn --workers 3 --bind unix:/home
Main PID: 30211 (code=exited, status=216/GROUP)
Feb 01 11:26:01 ip-172-31-17-122 systemd[1]: Started gunicorn daemon.
Feb 01 11:26:01 ip-172-31-17-122 systemd[1]: gunicorn.service: Main process exited, code=exited, sta
Feb 01 11:26:01 ip-172-31-17-122 systemd[1]: gunicorn.service: Unit entered failed state.
Feb 01 11:26:01 ip-172-31-17-122 systemd[1]: gunicorn.service: Failed with result 'exit-code'.
lines 1-10/10 (END)
Pouvez-vous poster votre configuration nginx? –
@DanielHepper aurait dû l'inclure, mis à jour. –