Question
Flask+nginx+uwsgi+Ubuntu tutorial
My hopes are lost and so is my temper. I have followed the tutorial found here -
https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-uwsgi-and-nginx-on-ubuntu-16-04
I have reinstalled and started all over 10 times and still same PROBLEM. Is there another tutorial available because this only works to 80%.
All works fine up to a certain point but I always get a 502 gateway problem.
I created a new user belonging to sudo group.
Ssh:ed to server with this new user – all good.
Set up domain also and if I ping domainname.com the correct droplet ip gives reply – all good.
python myproject.py (to start flask) works perfect
uwsgi –socket 0.0.0.0:5000 –protocol=http -w wsgi:app
Works perfect and site is accessible with IP http://server_IP:5000
Content of wsgi.py-
from myproject import app
if name == “_main”:
app.run()
Content of myproject.ini looks like -
[uwsgi]
module = wsgi:app
master = true
processes = 5
socket = myproject.sock
chmod-socket = 660
vacuum = true
die-on-term = true
Content of /etc/systemd/system/myproject.service:
[Unit]
Description=uWSGI instance to serve myproject
After=network.target
[Service]
User = blizzard
Group = www-data
WorkingDirectory = /home/blizzard/myproject
Environment = “PATH=/home/blizzard/myproject/myprojectenv/bin” #IS THIS LINE WRONG??
ExecStart=/home/blizzard/myprojectenv/bin/uwsgi –ini myproject.ini
[Install]
WantedBy = multi-user.target
Content of /etc/nginx/available-sites/myproject
server {
listen 80;
server_name billigaflygtilllondon.com www.billigaflygtilllondon.com;
location / {
include uwsgi_params;
uwsgi_pass unix:///home/blizzard/myproject/myproject.sock;
}
}
If this tutorial is wrong why dont staff delete it or at least the author updates it since I am not the ONLY ONE having problems. If there is a helpful soul who could guide me I would be more than happy.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×
Could it be a permission error since www-data has no permission inside homefolder ?
Could this be the problem?
Or is it a domain issue?
Anyone ?
Think I have found the problem, or at least one of them.
Did
sudo systemctl status myproject.service
And it returned FAILED....and now to the $10000000 question why?
Thank you very much, it helped me a lot
Greetings from Peru