By kycalica
followed one of the tutorials on digitalocean to be able to set up a flask app using uwsgi and nginx.
But I am having a 502 Bad Gateway error everytime I try to connect to it. When looking in the /var/log/nginx/errors.log it shows that the connection was refused.
I have been trying to figure this out for days. Can someone please tell me whats wrong? I think it’s the permissions but I dont know what the permissions are suppose to be.
/var/log/nginx/error.log:
2016/08/01 16:12:13 [error] 18539#18539: *1 connect() to unix:/home/lit/howlit/how_lit_restapi.sock failed (111: Connection refused) while connecting to upstream,
here is my howlit.ini file:
[uwsgi]
module = wsgi:app
master = true
processes = 5
socket = how_lit_restapi.sock
chmod-sock = 666
vaccum = true
die-on-term = true
Here is my permissions in the app directory:
drwx---r-x 6 lit www-data 4096 Jul 29 11:47 env
-rwx---r-x 1 lit www-data 141 Jul 29 19:01 howlit.ini
-rwx---r-x 1 lit www-data 1175 Jul 29 11:52 how_lit_restapi.py
-rwx---r-x 1 lit www-data 1781 Jul 29 11:54 how_lit_restapi.pyc
srwx---r-x 1 lit www-data 0 Jul 29 16:46 how_lit_restapi.sock
-rwx---r-x 1 lit www-data 73 Jul 29 11:54 wsgi.py
-rwx---r-x 1 lit www-data 218 Jul 29 11:54 wsgi.pyc
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Here is my nginx config file in /etc/nginx/sites-enabled file:
root@digitalocean:~# cat /etc/nginx/sites-enabled/how_lit
server {
listen 80;
server_name XXX.XX.XX;
location / {
include uwsgi_params;
uwsgi_pass unix:/home/lit/howlit/how_lit_restapi.sock;
}
}
The XXX.XX.XX has a real ip address didnt want to put mine out there.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.