USE THIS: https://www.digitalocean.com/community/tutorials/how-to-serve-flask-applications-with-gunicorn-and-nginx-on-ubuntu-18-04
FOR THE LOVE OF GOD MAKE SURE YOU USE ONLY A SINGLE SUDO NON ROOT FOR THIS OR WILL BREAK
ssh in
apt-get update
apt install python3-pip nginx
#config nginx
/etc/init.d/nginx start
#remove orig config
rm /etc/nginx/sites-enabled/default
touch /etc/nginx/sites-available/flask_settings
ln -s /etc/nginx/sites-available/flask_settings /etc/nginx/sites-enabled/flask_settings
nano /etc/nginx/sites-enabled/flask_settings
server {
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
/etc/init.d/nginx restart
pip3 install virtualenv
#setup virtualenv
virtualenv -p python3 ENVNAME #for python3
#install dependencies
source viv/bin/activate
(viv)install dependencies
pip install flask gunicorn
#run it and it should default to the main ip.
gunicorn pythonfilename:app < the main thing to follow. usually app.