Created
November 5, 2020 23:58
-
-
Save maniac787/8d8b0d57b89af3dad1b46f0d1b131840 to your computer and use it in GitHub Desktop.
Instalar Nginx + Flask
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt update | |
sudo apt install nginx | |
sudo systemctl status nginx | |
sudo systemctl restart nginx | |
sudo systemctl disable nginx | |
sudo systemctl enable nginx | |
sudo apt install python3-pip python3-dev build-essential libssl-dev libffi-dev python3-setuptools | |
pip install wheel | |
pip install uwsgi | |
copiar vi ~/denuncia/wsgi.py | |
copiar vi ~/denuncia/denuncia.ini | |
#sudo vi /etc/systemd/system/denuncia.service | |
[Unit] | |
Description=uWSGI instance to serve denuncia | |
After=network.target | |
[Service] | |
User=roberto | |
Group=www-data | |
WorkingDirectory=/home/software/denuncia/py_denuncia | |
Environment="PATH=/home/software/denuncia/py_denuncia/venv/bin" | |
ExecStart=/home/software/denuncia/py_denuncia/venv/bin/uwsgi --ini denuncia.ini | |
[Install] | |
WantedBy=multi-user.target | |
#Probar | |
uwsgi --socket 0.0.0.0:5000 --protocol=http -w wsgi:app | |
sudo systemctl start denuncia | |
sudo systemctl status denuncia | |
# para que incie con el sistema | |
sudo systemctl enable denuncia | |
#Enlazar con nginx | |
sudo vi /etc/nginx/sites-available/denuncia | |
server{ | |
listen 80; | |
server_name 45.79.26.15; | |
location / { | |
include uwsgi_params; | |
uwsgi_pass unix:/home/software/denuncia/py_denuncia/denuncia.sock; | |
} | |
} | |
sudo ln -s /etc/nginx/sites-available/denuncia /etc/nginx/sites-enabled | |
sudo nginx -t | |
sudo systemctl stop denuncia nginx | |
sudo systemctl start denuncia nginx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment