Created
November 10, 2021 21:41
-
-
Save randercarlos/c3522b0dcac6fa68c66636c4c42b10a7 to your computer and use it in GitHub Desktop.
Exemplo de configuração do nginx com HTTPS(SSL)
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
# criar diretório do projeto em /var/www (exemplo: /var/www/teste.testandoapi.click) | |
# instalar os certificados SSL com o certbot em https://certbot.eff.org/ | |
# usar o comando abaixo trocando apenas o subdomínio para gerar os certificados | |
# sudo certbot certonly --manual -d \*.testandoapi.click --agree-tos --no-bootstrap --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory | |
# criar subdominio no route 53 da Amazon ou em outro provider e criar um record apontando para o ip da máquina | |
# configurar o nginx usando o arquivo abaixo como exemplo | |
server { | |
listen 80 default_server; | |
listen [::]:80 default_server; | |
listen 443 ssl; | |
server_name teste.testandoapi.click; | |
# SSL configuration | |
# | |
root /var/www/teste.testandoapi.click; | |
# Add index.php to the list if you are using PHP | |
index index.html index.htm index.nginx-debian.html; | |
server_name teste.testandoapi.click; | |
ssl_certificate /etc/letsencrypt/live/testandoapi.click/fullchain.pem; | |
ssl_certificate_key /etc/letsencrypt/live/testandoapi.click/privkey.pem; | |
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; | |
location / { | |
# First attempt to serve request as file, then | |
# as directory, then fall back to displaying a 404. | |
try_files $uri $uri/ =404; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment