0.修改gunicorn -log格式
gunicorn -w 2 -b 127.0.0.1:8001 test:app --access-logfile='-' --access-logformat='%({x-forwarded-for}i)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
upstream backend {
server 127.0.0.1:8001;
server 127.0.0.1:8002;
}
server{
listen 8000;
server_name localhost;
client_max_body_size 10m;
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_host;
# we don't want nginx trying to do something clever with
# redirects, we set the Host: header above already.
proxy_redirect off;
proxy_pass http://backend;
}
}