Last active
November 22, 2021 14:35
-
-
Save fabioafreitas/7f5c881df609813ef3d357c0c3150eb3 to your computer and use it in GitHub Desktop.
Projeto - Segurança de Sistemas - Comandos
This file contains hidden or 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
###### Acessando o sudo e sua home ###### | |
sudo su | |
cd ~ | |
############ Atualizando APT ############ | |
apt update -y | |
########### Instalando NGINX ############ | |
apt install nginx -y | |
####### Configurando Proxy Reverso ###### | |
unlink /etc/nginx/sites-enabled/default | |
cd /etc/nginx/sites-available | |
nano reverse-proxy.conf | |
## COLAR COMANDOS DO ARQUIVO reverse-proxy.conf PRESENTE NESTA PÁGINA. LEMBRE-SE | |
## PREENCHER [DOMAIN_NAME] COM SEU DOMÍNIO E [PORT] COM A PORTA DA SUA APLICAÇÃO. | |
ln -s /etc/nginx/sites-available/reverse-proxy.conf /etc/nginx/sites-enabled/reverse-proxy.conf | |
########### Servidor Python3 ########### | |
apt install python3-pip -y | |
pip3 install flask | |
nano server.py | |
## COLAR OS COMANDOS DO ARQUIVO server.py PRESENTE NESTA PÁGINA | |
python3 server.py | |
# Para interromper o servidor digite: CTRL+C | |
########### Configurando SSL ########### | |
apt install certbot python3-certbot-nginx | |
# preencha [DOMAIN_NAME] com o domínio configurado no reverse-proxy.conf | |
certbot --nginx -d [DOMAIN_NAME] | |
## Leia atentamente e preencha os campos solicitados, brevemente o certificado | |
## Será emitido e o servidor terá o SSL configurado |
This file contains hidden or 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
server { | |
listen 80; | |
listen [::]:80; | |
server_name [DOMAIN_NAME]; | |
access_log /var/log/nginx/reverse-access.log; | |
error_log /var/log/nginx/reverse-error.log; | |
location / { | |
proxy_pass http://127.0.0.1:[PORT]; | |
} | |
} |
This file contains hidden or 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
from flask import Flask | |
app = Flask(__name__) | |
@app.route('/') | |
def get(): | |
return 'Hello, World!' | |
if __name__ == '__main__': | |
app.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment