...
> ./certbot-auto certonly
...
Installing with NGINX in a Docker Container
Build an image with certbot installed
> vi Dockerfile
Code Block |
---|
FROM webdevopslerenn/php-apache:ubuntu-12.04 nginx-reverse-proxy RUN apt-get update RUN apt-get install -y wget RUN wget https://dl.eff.org/certbot-auto RUN chmod a+x ./certbot-auto RUN ./certbot-auto -n --install-only |
> docker > docker build -t ca/certbot nginx .
Create a container from the image
> vi buildDocker.sh
Code Block |
---|
CONTAINER=certbotproxy IMAGE=ca/certbot HOSTNAME=$1nginx echo Configuring with hostname: $HOSTNAME docker stop $CONTAINER docker rm $CONTAINER docker run -d \ --namenet $CONTAINERhost \ --restart=always \ -p 707780:80 \ -h-name $HOSTNAME$CONTAINER \ -v $PWD/webconf:/appetc/nginx/sites-enabled \ -v $PWD/letsencrypt:/etc/letsencrypt \ -e php.short_open_tag='On' \ -e php.post_max_size='20971520' \ -e php.upload_max_filesize='20971520' \ -e php.magic_quotes_gpc='off' \ -e php.session.save_handler='files' \ $IMAGE |
> ./buildDocker.sh
View logs to see if the certbot our container started properly
> docker logs -f certbotproxy
Execute certbot-auto to create our cert
> docker exec -it certbot proxy ./certbot-auto certonly
Code Block |
---|
Saving debug log to /var/log/letsencrypt/letsencrypt.log HowFailed 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 authenticate with the ACME CA? 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: Spin up a temporaryNo redirect - Make no further changes to the webserver (standalone)configuration. 2: Place files in webroot directory (webroot) 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): 2 Plugins selected: Authenticator webroot, Installer None Please enter in your domain name(s) (comma and/or space separated) (Enter 'c' to cancel): test.jmehan.com Obtaining a new certificate Performing the following challenges: http-01 challenge for test.jmehan.com Input the webroot for test.jmehan.com: (Enter 'c' to cancel): /app Waiting for verification... Cleaning up challenges ...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 |
...