Skip to content

Instantly share code, notes, and snippets.

@jhowbhz
Last active October 13, 2023 22:42
Show Gist options
  • Save jhowbhz/d27da21ddf40c8f1e3da2fde170c9d1d to your computer and use it in GitHub Desktop.
Save jhowbhz/d27da21ddf40c8f1e3da2fde170c9d1d to your computer and use it in GitHub Desktop.
ServerBlock Nginx
#instale o nginx e o certbot
sudo apt update && apt install nginx python3-certbot-nginx -y
#Vamos criar o arquivo.
nano /etc/nginx/sites-available/api
#Cole lá dentro do arquivo Altere a porta que desejar :3333 ou :####
upstream myzap-v2 {
server 127.0.0.1:3333;
keepalive 8;
}
server {
server_name SEU_DOMINIO.COM.BR;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://myzap-v2/;
proxy_redirect off;
}
listen 80;
}
#Depois roda isso...
ln -s /etc/nginx/sites-available/api /etc/nginx/sites-enabled/api
#Finalizando
certbot --nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment