G
G
Grigory Dikiy2017-01-09 16:16:40
Django
Grigory Dikiy, 2017-01-09 16:16:40

Deploy Django: nginx + guricorn?

Good afternoon! I'm trying to figure out why the socket file is not being created in the directory and with the project, but all my efforts have been unsuccessful. I did everything according to the tutorial: tyts .
But when starting the project, I get the following problems:
sudo tail -f /var/log/nginx/error.log
2017/01/09 12:55:14 [crit] 3800#3800: *1 connect() to unix:/home/dikiigr/posuda_shop/engine/posuda_shop.sock failed (2: No such file or directory) while connecting to upstream, client: 178.132.120.66, server: 89.223.28.112, request: "GET / HTTP/1.1", upstream: " http://unix:/home/dikiigr/posuda_shop/engine/ posud... ", host: "89.223.28.112"
sudo systemctl status gunicorn.service

● gunicorn.service - gunicorn daemon
Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2017-01-09 12:39:12 UTC; 24min ago
Main PID: 2860 (gunicorn)
Tasks: 4 (limit: 512)
CGroup: /system.slice/gunicorn.service
├─2860 /home/dikiigr/posuda_shop/env/bin/python3 /home/dikiigr/posuda_shop/env /bin/gunicorn --wo
├─2864 /home/dikiigr/posuda_shop/env/bin/python3 /home/dikiigr/posuda_shop/env/bin/gunicorn --wo
├─2866 /home/dikiigr/posuda_shop/env/bin /python3 /home/dikiigr/posuda_shop/env/bin/gunicorn --wo
└─2867 /home/dikiigr/posuda_shop/env/bin/python3 /home/dikiigr/posuda_shop/env/bin/gunicorn --wo Configuration

file guricorn:

[Unit]
Description=gunicorn daemon
After=network.target

[Service]
User=dikiigr
Group=www-data
WorkingDirectory=/home/dikiigr/posuda_shop/engine
ExecStart=/home/dikiigr/posuda_shop/env/bin/gunicorn --workers 3 --bind unix:/home/dikiigr/posuda_shop/engine/posuda_shop.sock posuda_shop.wsgi:application

[Install]
WantedBy=multi-user.target

File with nginx settings:
server {
    listen 80;
    server_name 89.223.28.112;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
         root /home/dikiigr/posuda_shop/engine;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/home/dikiigr/posuda_shop/engine/posuda_shop.sock;
    }
}

Check access:
la -la
drwxrwsr-x 4 dikiigr dikiigr 4096 Jan 9 11:40 .
drwxrwsr-x 4 dikiigr dikiigr 4096 Jan 9 12:39 .. -rwxrwxr -
x 1 dikiigr dikiigr 809 Jan 9 11:34 manage.py Jan 9 11:40 static

Groups that dikiigr is a member of:
dikiigr : dikiigr sudo www-data
Project folders:
/home/dikiigr/posuda_shop:
drwxrwsr-x 4 dikiigr dikiigr 4096 Jan 9 11:40 engine
drwxrwxr-x 5 dikiigr dikiigr 4096 Jan 9 11:32 env

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pcdesign, 2017-01-09
@frilix

Try for now without a socket, but just on some port
Make sure that everything works on port 8001.
Then you can create a service and register it in nginx.
And then if you really want to make a socket.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question