I am working at my django
project with nginx
and gunicorn
, as it said here:
https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-14-04
My site works locally, but when I start nginx
and gunicorn
server I had
502 Bad Gateway error.
OS is UBUNTU 14.04
I'm trying to make my project working, and reinstall everything as root (I know its bad) - the same mistake.
Here is my "error.log":
2016/04/20 20:15:10 [crit] 10119#0: *1 connect() to
unix:/root/myproject/myproject.sock failed (13: Permission denied) while connecting to upstream, client: 46.164.23
When i run 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()
My 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
Thats my "/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;
}
}
I will appreciate your help very much!!!