Flask works fine, after some time user login and contact pages (POST method) stop

  Kiến thức lập trình

I have a Flask app that I deployed to Linode using Nginx,Gunicorn and Supervisor,it works great for quite some time and then after that the pages keep loading fine but user logins or other POST requests like contact us stop working. std.err.log file shows no error, however nginx error file shows “failed(111: connection refused while connecting to upstream”. Let me know if there is anything that I can try

This is how nginx is configured:

server {
    server_name www.datiance.org;

    location /static/css/ {
        alias /home/ier/flask_blog/static/css/;
    }

    location /static/images/ {
        alias /home/ier/flask_blog/static/images/;
    }

    location / {
        proxy_pass http://localhost:8000;
        include /etc/nginx/proxy_params;
        proxy_redirect off;
    }

    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/www.datiance.org/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/www.daiance.org/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

This is how supervisiro configuration file looks like:

[program:flaskblog]
directory=/home/ier/flask_blog
command=/home/ier/flask_app/venv/bin/gunicorn -w 3 blog:app
user=ier
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
stderr_logfile=/var/log/flaskblog/flask_blog.err.log
stdout_logfile=/var/log/flaskblog/flask_blog.out.log

LEAVE A COMMENT