Задать вопрос
@nazandr

Как исправить ошибку 502 Bad Gateway nginx/1.10.0 (Ubuntu) Nginx?

Как исправить ошибуку
2016/10/03 11:58:14 [error] 22667#22667: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 90.154.72.246, server: 95.85.3.58, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8001", host: "95.85.3.58:8000"
2016/10/03 12:03:22 [error] 22667#22667: *7 connect() failed (111: Connection refused) while connecting to upstream, client: 90.154.72.246, server: 95.85.3.58, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8001", host: "95.85.3.58:8000"
2016/10/03 12:06:38 [notice] 22806#22806: signal process started
2016/10/03 12:06:43 [error] 22810#22810: *9 connect() failed (111: Connection refused) while connecting to upstream, client: 90.154.72.246, server: 95.85.3.58, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8001", host: "95.85.3.58:8000"
2016/10/03 12:08:20 [error] 22810#22810: *11 connect() failed (111: Connection refused) while connecting to upstream, client: 90.154.72.246, server: 95.85.3.58, request: "GET / HTTP/1.1", upstream: "uwsgi://127.0.0.1:8001", host: "95.85.3.58:8000"

nginx.conf
# mysite_nginx.conf

# the upstream component nginx needs to connect to
upstream django {
    # server unix:///path/to/your/mysite/mysite.sock; # for a file socket
    server 127.0.0.1:8001; # for a web port socket (we'll use this first)
}

# configuration of the server
server {
    # the port your site will be served on
    listen      8000;
    # the domain name it will serve for
    server_name 95.85.3.58; # substitute your machine's IP address or FQDN
    charset     utf-8;

    # max upload size
    client_max_body_size 75M;   # adjust to taste

    location /static {
        alias /ProjectBlog/blog/static; # your Django project's static files - amend as required
    }

    # Finally, send all non-media requests to the Django server.
    location / {
        uwsgi_pass  django;
        include     /ProjectBlog/blog/uwsgi_params; # the uwsgi_params file you installed
    }
}
  • Вопрос задан
  • 3543 просмотра
Подписаться 2 Оценить 4 комментария
Пригласить эксперта
Ответы на вопрос 1
@artinnok
бекенд-программист
Думаю, у вас uwsgi слушает на другом порту - попробуйте так:
uwsgi --http :8001
либо
uwsgi --socket :8001


Также, у вас nginx на другом порту - необходимо повесить его на 80:
listen 80;

Также, почитайте эту статью.

Обычно работа построена так:
Nginx (80) -> uWSGI (8000)
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы