nginx 502错误-连接到上游时失败(111:连接被拒绝)

nginx 502错误-连接到上游时失败(111:连接被拒绝),nginx,flask,cloudflare,Nginx,Flask,Cloudflare,尝试使用https访问我的域时出现502网关错误 我在用 Flask部署webhook接收器(Flask应用程序正在监听127.0.0.1:3000) NGINX以创建反向代理系统(使用代理通行证) Cloudflare以创建TLS证书(适用于nginx的https) 这是我的档案 错误日志 nginx.conf pyapp.conf(nginx.conf中包含的文件) 在这种情况下会出现什么错误?它是在配置中还是我设置flask应用程序的方式 2019/09/14 09

尝试使用https访问我的域时出现502网关错误

我在用

  • Flask部署webhook接收器(Flask应用程序正在监听127.0.0.1:3000)
  • NGINX以创建反向代理系统(使用代理通行证)
  • Cloudflare以创建TLS证书(适用于nginx的https)
这是我的档案

  • 错误日志
  • nginx.conf
  • pyapp.conf(nginx.conf中包含的文件)
在这种情况下会出现什么错误?它是在配置中还是我设置flask应用程序的方式

    2019/09/14 09:39:12 [error] 11617#11617: *1068 connect() failed (111: Connection refused) while connecting to upstream, client: 162.158.123.167, server: whatisbrazil.club, request: "GET / HTTP/1.1", upstream: "https://127.0.0.1:3000/", host: "whatisbrazil.club"
    2019/09/14 16:36:58 [warn] 13605#13605: the "ssl" directive is deprecated, use the "listen ... ssl" directive instead in /etc/nginx/conf.d/pyapp.conf:5

    user  nginx;
    worker_processes  1;

    error_log  /var/log/nginx/error.log warn;
    pid        /var/run/nginx.pid;


    events {
        worker_connections  1024;
    }


    http {
        include       /etc/nginx/mime.types;
        default_type  application/octet-stream;

        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';

        access_log  /var/log/nginx/access.log  main;

        sendfile        on;
        #tcp_nopush     on;

        keepalive_timeout  65;

        #gzip  on;

        upstream mysite {
           server 127.0.0.1:3000;
           keepalive 32;
        } 

        include /etc/nginx/conf.d/*.conf;
    }

    server {

        listen   443;
        ssl    on;
        ssl_certificate    /etc/ssl/whatisbrazil.club.pem; 
        ssl_certificate_key    /etc/ssl/whatisbrazil.club.key;
        server_name whatisbrazil.club;
        access_log /var/log/nginx/nginx.vhost.access.log;
        error_log /var/log/nginx/nginx.vhost.error.log;

        location / {
            proxy_pass https://127.0.0.1:3000/;
            proxy_buffer_size   126k;
            proxy_buffers   4 256k;
            proxy_busy_buffers_size 256k;
        }
    }