└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # Configuração do arquivo default para NGINX do vídeo sobre APIs em VPS do Youtube 2 | Link do vídeo: https://youtu.be/pIvHp7sk2UA 3 | 4 | Como seu arquivo deve parecer após as configurações com NGINX e Certbot: 5 | ``` 6 | server { 7 | server_name apicafes.online www.apicafes.online; # Adicionar o seu domínio, tanto sozinho quanto com www. 8 | location / { 9 | proxy_pass http://localhost:3000; # Supondo que sua API esteja rodando na porta 3000 10 | proxy_http_version 1.1; 11 | proxy_set_header Upgrade $http_upgrade; 12 | proxy_set_header Connection 'upgrade'; 13 | proxy_set_header Host $host; 14 | proxy_cache_bypass $http_upgrade; 15 | } 16 | listen 443 ssl; # managed by Certbot 17 | ssl_certificate /etc/letsencrypt/live/apicafes.online/fullchain.pem; # mana> 18 | ssl_certificate_key /etc/letsencrypt/live/apicafes.online/privkey.pem; # ma> 19 | include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot 20 | ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot 21 | } 22 | server { 23 | if ($host = www.apicafes.online) { 24 | return 301 https://$host$request_uri; 25 | } # managed by Certbot 26 | if ($host = apicafes.online) { 27 | return 301 https://$host$request_uri; 28 | } # managed by Certbot 29 | listen 80; 30 | server_name apicafes.online www.apicafes.online; 31 | return 404; # managed by Certbot 32 | } 33 | ``` 34 | --------------------------------------------------------------------------------