Skip to content

Instantly share code, notes, and snippets.

@eslam-mahmoud
Last active January 30, 2021 17:04
Show Gist options
  • Save eslam-mahmoud/bddece7a407ea920e3600e48756bbd34 to your computer and use it in GitHub Desktop.
Save eslam-mahmoud/bddece7a407ea920e3600e48756bbd34 to your computer and use it in GitHub Desktop.
create Certbot SSL on Docker Nginx on AWS - digitalocean
https://www.digitalocean.com/community/tutorials/how-to-acquire-a-let-s-encrypt-certificate-using-dns-validation-with-certbot-dns-digitalocean-on-ubuntu-20-04
https://www.humankode.com/ssl/how-to-set-up-free-ssl-certificates-from-lets-encrypt-using-docker-and-nginx
-> https://certbot-dns-digitalocean.readthedocs.io/en/stable/
certbot certonly --dns-digitalocean --dns-digitalocean-credentials ~/digitaloceanapikey.ini --preferred-challenges=dns -d=example.com -d=*.example.com
nano /etc/nginx/sites-available/x-app
ln -s /etc/nginx/sites-available/x-app /etc/nginx/sites-enabled/x-app
sudo service nginx configtest
sudo service nginx restart
```
server {
listen 80;
server_name app.example.com;
server_tokens off;
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name app.example.com;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
location / {
proxy_pass http://localhost:7002;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment