A
A
Andrey2017-02-03 05:48:00
Django
Andrey, 2017-02-03 05:48:00

How to debug a bunch of nginx, gunicorn, django?

I did everything according to the recipe djbook.ru/forum/topic/2416
- installed a virtual environment, django, gunicorn, nginx, supervisor
- set up configuration files
but still the site does not start.
How can you track exactly where you screwed up?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey, 2017-02-07
@andreysharypov

It was necessary to open port 80.

A
Artyom Innokentiev, 2017-02-03
@artinnok

Try to start without a supervisor - nginx, your Django project. Proxy the request from nginx to port 8000 of the local djanga server. This is the first iteration.
Then screw on the gunicorn. Now nginx will proxy requests to gunicorn, and it will run your project. This is the second iteration.
Then supervisor. Now the supervisor will pick up the gunicorn from under him, nginx works offline. For a start, this is enough for you.

nginx:
server {
  listen 80;
  server_name example.com; #либо ip, либо доменное имя

  location / {
      proxy_pass http://127.0.0.1:8000;
      proxy_set_header Host $server_name;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  }
}

django:
python manage.py runserver

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question