Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use "let's encrypt" without stopping nginx?

I am adding https support to our servers. How can I not stop Nginx when adding Let's Encrypt support?

like image 348
Check King Avatar asked Mar 13 '17 05:03

Check King


People also ask

Can I use Letsencrypt with nginx?

Let's Encrypt supports automated installation on nginx, the certificates can be easily obtained using the --nginx plugin together with other commands. The --nginx plugin automates obtaining certificates from the CA when using Nginx web server software. To use this plugin on the command line using the example below.


2 Answers

against all answers you can run certbot in nginx mode.
just read the docs for it.
all you have to do is install an additional nginx plugin and follow the docs of certbot.
that plugin would even hot reload the cached certificates in nginx ram as soon as they get updated.

https://certbot.eff.org/instructions

or go to the nginx docs instead: https://www.nginx.com/blog/using-free-ssltls-certificates-from-lets-encrypt-with-nginx/

like image 139
GottZ Avatar answered Oct 03 '22 15:10

GottZ


You can use docker for that. Link on hub.docker

For example:

Create certbot.sh

For that you must run in CLI:

touch certbot.sh && chmod +x ./certbot.sh

Write in file:

#!/usr/bin/env bash
docker run --rm -v /etc/letsencrypt:/etc/letsencrypt -v /var/lib/letsencrypt:/var/lib/letsencrypt certbot/certbot "$@"

and run like this:

./certbot.sh --webroot -w /var/www/example -d example.com -d www.example.com -w /var/www/thing -d thing.is -d m.thing.is

OR

./certbot.sh renew

And you can add call this method in crontab for renew

0 0 1 * * /<PATH_TO_FILE>/certbot.sh renew
like image 41
Maxim Tkach Avatar answered Oct 03 '22 15:10

Maxim Tkach