Skip to content

Instantly share code, notes, and snippets.

@masasdani
Last active October 18, 2021 03:38
Show Gist options
  • Save masasdani/3ba868a24e6c5d97ef095fa8a21689b4 to your computer and use it in GitHub Desktop.
Save masasdani/3ba868a24e6c5d97ef095fa8a21689b4 to your computer and use it in GitHub Desktop.
certbot-nginx-amazon-linux-2
sudo amazon-linux-extras install epel
sudo yum install certbot python2-certbot-nginx
# nginx .conf
/etc/nginx/cond.d/yourdomain.conf
server {
server_name yourdomain.com;
location / {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://localhost:3001;
}
listen 80;
}
sudo certbot --nginx -d yourdomain.com
sudo crontab -e
0 10 * * * /usr/bin/certbot renew --quiet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment