502 Плохой шлюз на Raspberry Pi - PullRequest
0 голосов
/ 29 ноября 2018

Я пытаюсь разместить веб-сервер на Raspberry Pi, используя uwsgi, nginx, flask и виртуальную среду.С нижеуказанным config

myproject.ini

[uwsgi]
module = wsgi:app

master = true
processes = 5

socket = /tmp/myproject.sock
chmod-socket = 660
vacuum = true

die-on-term = true

myproject.py

from flask import Flask
app = Flask(__name__)

@app.route("/get/")
def hello():
    return "<h1 style='color:blue'>Hello There!</h1>"

if __name__ == "__main__":
    app.run(host='0.0.0.0')

wsgi.py

from myproject import app

if __name__ == "__main__":
    app.run()

файл конфигурации nginx

(myprojectenv) shoaib@raspberrypi:/etc/nginx/sites-available $ cat myproject 

server {
    listen 80;
    server_name www.frasmd.com  frasmd.com 10.10.10.10;

    location / {
    proxy_request_buffering off;
    proxy_buffering off;
        include uwsgi_params;
        uwsgi_pass unix:/tmp/myproject.sock;
    }
}

Когда я запускаю службы, я не получаю ошибок при их запуске, но когда я даю URL в браузере Chromium, я получаю "502 Badgateway".Я перепробовал все, что мог найти, но не помог.Я что-то упустил в конфигурации?

Я получаю приведенную ниже ошибку в моем /var/log/nginx/error.log

2018/11/30 00:42:28 [error] 4368#4368: *1 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: www.frasmd.com, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:/tmp/myproject.sock:", host: "0.0.0.0", referrer: "http://0.0.0.0/get"
2018/11/30 00:43:15 [error] 4368#4368: *1 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: www.frasmd.com, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:/tmp/myproject.sock:", host: "0.0.0.0"
2018/11/30 00:43:15 [error] 4368#4368: *1 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: www.frasmd.com, request: "GET /favicon.ico HTTP/1.1", upstream: "uwsgi://unix:/tmp/myproject.sock:", host: "0.0.0.0", referrer: "http://0.0.0.0/"
...