Running Locally
Installing
> wget https://dl.eff.org/certbot-auto
> chmod a+x ./certbot-auto
> ./certbot-auto -n --install-only
Running certbot-auto to generate a certificate
> ./certbot-auto certonly
Installing with NGINX in a Docker Container
Build an image with certbot installed
> vi Dockerfile
FROM lerenn/nginx-reverse-proxy RUN apt-get update RUN apt-get install -y wget RUN wget https://dl.eff.org/certbot-auto RUN chmod +x certbot-auto RUN ./certbot-auto -n --install-only
> docker build -t ca/nginx .
Create a container from the image
> vi buildDocker.sh
CONTAINER=proxy IMAGE=ca/nginx docker stop $CONTAINER docker rm $CONTAINER docker run -d \ --net host \ --restart=always \ -p 80:80 \ --name $CONTAINER \ -v $PWD/conf:/etc/nginx/sites-enabled \ -v $PWD/letsencrypt:/etc/letsencrypt \ $IMAGE
> ./buildDocker.sh
View logs to see if our container started properly
> docker logs -f proxy
Execute certbot-auto to create our cert
> docker exec -it proxy ./certbot-auto
Saving debug log to /var/log/letsencrypt/letsencrypt.log Failed to find executable apache2ctl in PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin Plugins selected: Authenticator nginx, Installer nginx Which names would you like to activate HTTPS for? ------------------------------------------------------------------------------- 1: creativeattitude.com 2: www.creativeattitude.com ------------------------------------------------------------------------------- Select the appropriate numbers separated by commas and/or spaces, or leave input blank to select all options shown (Enter 'c' to cancel): 1 Obtaining a new certificate Performing the following challenges: http-01 challenge for creativeattitude.com Waiting for verification... Cleaning up challenges Deploying Certificate to VirtualHost /etc/nginx/sites-enabled/creativeattitude.conf Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access. ------------------------------------------------------------------------------- 1: No redirect - Make no further changes to the webserver configuration. 2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for new sites, or if you're confident your site works on HTTPS. You can undo this change by editing your web server's configuration. ------------------------------------------------------------------------------- Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 1 ------------------------------------------------------------------------------- Congratulations! You have successfully enabled https://creativeattitude.com You should test your configuration at: https://www.ssllabs.com/ssltest/analyze.html?d=creativeattitude.com ------------------------------------------------------------------------------- IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/creativeattitude.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/creativeattitude.com/privkey.pem Your cert will expire on 2018-07-22. To obtain a new or tweaked version of this certificate in the future, simply run certbot-auto again with the "certonly" option. To non-interactively renew *all* of your certificates, run "certbot-auto renew" - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le
References
Reference | URL |
---|---|
Getting Started | https://letsencrypt.org/getting-started/ |
*Using Certbot Auto | https://certbot.eff.org/docs/install.html#certbot-auto |
Certbot User Guide | https://certbot.eff.org/docs/using.html#certbot-commands |