My domain is: digifo.io
I ran this command: ./init-letsencrypt.sh
It produced this output:
### Creating dummy certificate for digifo.io …
Generating a RSA private key
…+++++
…+++++
writing new private key to ‘/etc/letsencrypt/live/digifo.io/privkey.pem’
-----
### Starting nginx ...
Recreating digifo_nginx_1 ... done
### Deleting dummy certificate for digifo.io ...
### Requesting Let's Encrypt certificate for digifo.io ...
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator webroot, Installer None
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for digifo.io
Using the webroot path /var/www/certbot for all unmatched domains.
Waiting for verification...
Challenge failed for domain digifo.io
http-01 challenge for digifo.io
Cleaning up challenges
Some challenges have failed.
IMPORTANT NOTES:
- The following errors were reported by the server:
Domain: digifo.io
Type: connection
Detail: Fetching
http://digifo.io/.well-known/acme-challenge/P81q7EYRm5eBwj-m3bSHe2K4yHZUAEfDeAf11eHFvDg:
Connection refused
To fix these errors, please make sure that your domain name was
entered correctly and the DNS A/AAAA record(s) for that domain
contain(s) the right IP address. Additionally, please check that
your computer has a publicly routable IP address and that no
firewalls are preventing the server from communicating with the
client. If you're using the webroot plugin, you should also verify
that you are serving files from the webroot path you provided.
### Reloading nginx ...
ERROR: Container 8f6a469bb3c755868743df7ce55c52461896290d388d66b4064fe515eb0d70fc is restarting, wait until the container is running
My web server is (include version): ubuntu 18.
My hosting provider, if applicable, is: digitalocean
I can login to a root shell on my machine (yes or no, or I don’t know): yes
I’m using a control panel to manage my site (no, or provide the name and version of the control panel): no
The version of my client is (e.g. output of certbot --version
or certbot-auto --version
if you’re using Certbot): I am using latest cerbot docker image
I’ve followed the following blog post: https://medium.com/@pentacent/nginx-and-lets-encrypt-with-docker-in-less-than-5-minutes-b4b8a60d3a71
Which suggests to use a helper script ./init-letsencrypt.sh (https://github.com/wmnnd/nginx-certbot/blob/master/init-letsencrypt.sh)
As mentioned I am using docker for both nginx and cerbot. Here is the docker-compose file:
app1: &app1
image: vlio20/digifo:${APP_TAG}
container_name: app1
ports:
- "8080:8080"
environment:
- NODE_ENV=prod
networks:
- docker
depends_on:
- mysql
logging:
<<: *logging
nginx:
image: nginx:alpine
restart: unless-stopped
volumes:
- ./revers-proxy/nginx:/etc/nginx/
- ./revers-proxy/certbot/conf:/etc/letsencrypt
- ./revers-proxy/certbot/www:/var/www/certbo
ports:
- "80:80"
- "443:443"
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
networks:
- docker
logging:
<<: *logging
certbot:
image: certbot/certbot
restart: unless-stopped
volumes:
- ./revers-proxy/certbot/conf:/etc/letsencrypt
- ./revers-proxy/certbot/www:/var/www/certbot
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
and here is my nginx config:
server {
listen 80;
server_name digifo.io;
server_tokens off;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl;
server_name digifo.io;
server_tokens off;
ssl_certificate /etc/letsencrypt/live/digifo.io/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/digifo.io/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
location / {
proxy_pass http://app1:8080;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
I don’t have any firewall set. What did I miss?