Nginx and letsencrypt acme-challenge
Jul 24, 2017I had some struggle to get certbot and nginx webroot plugin to play nice with my setups.
After some roaming of forums and stackexchange I found a solution that suits my nginx configuration and certbot.
I modified the info from this source:
https://community.letsencrypt.org/t/how-to-nginx-configuration-to-enable-acme-challenge-support-on-all-http-virtual-hosts/5622
So I just place it here and perhaps someone can be helped by this.
To the magic. Erhmm config..
sudo mkdir -p /var/www/letsencrypt/.well-known/acme-challenge/
sudo vim /etc/nginx/snippets/letsencrypt-acme-challenge.conf
And then in the ssl enabled vhosts you insert this.
After everything worked with a nginx reload, try to get the new cert.
sudo letsencrypt certonly -a webroot --webroot-path=/var/www/letsencrypt -d example.com
And at last do not forget your well earned Coffee.