Skip to content

Instantly share code, notes, and snippets.

@selfagency
Created July 11, 2021 01:11
Show Gist options
  • Select an option

  • Save selfagency/bb910c56a611969ff4a029a170a1ab00 to your computer and use it in GitHub Desktop.

Select an option

Save selfagency/bb910c56a611969ff4a029a170a1ab00 to your computer and use it in GitHub Desktop.
config nginx with certbot
#!/usr/bin/env bash
$DOMAIN=selfagency.dev
$EMAIL=hello@selfagency.dev
sudo sed -i -r 's/(listen .*443)/\1;#/g; s/(ssl_(certificate|certificate_key|trusted_certificate) )/#;#\1/g' /etc/nginx/sites-available/$DOMAIN.conf
sudo certbot certonly --webroot -d $DOMAIN --email $EMAIL -w /var/www/_letsencrypt -n --agree-tos --force-renewal
sudo sed -i -r 's/#?;#//g' /etc/nginx/sites-available/$DOMAIN.conf
sudo nginx -t && sudo systemctl reload nginx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment