Closed jeremeybingham closed 5 years ago
I think you ran into the same issue as I had yesterday. First of all make sure your subdomains are reachable (try pinging them). I followed the steps below to get the current master code working for 2 domains.
Modify configuration:
Run the init script: ./init-letsencrypt.sh
The mistake I did was to change all the occurances of example.org in the second domain's configuration file. The certificate path should be same for both configurations.
Weird, so I made that change noted exactly as you suspected:
The mistake I did was to change all the occurances of example.org in the second domain's configuration file. The certificate path should be same for both configurations.
And now the certificates are issued correctly when I run the script, but neither of my domains resolve to the right page - they just time out.
On this step:
create new configuration file for every domain under nginx folder (similar to existing app.conf)
I wasn't sure what to do - as above, I had the nginx.conf for both domains/servers in a single file. I split that file in half; naming the two resulting files "web.conf" and "web-dev.conf" and ran it both like that and with them in a single file as above - both methods seem to work in terms of issuing certificates but both also result in the timeout when I try to load the page in a browser.
However, that's still an nginx issue, not one with this script, I guess. I'll keep working on it and try to figure out what's going on - I suspect it's either the ports or the fact that I need to clear out my Docker containers and old images on this machine completely, maybe there's remnants of old port allocations or something causing a problem. THANK YOU!
for your information I am using latest image of nginx, not the one in the master code. Here is my docker compose
version: '2'
services: nginx: image: nginx restart: unless-stopped volumes:
- ./data/nginx:/etc/nginx/conf.d
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot ports:
- "80:80"
- "443:443" command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'" network_mode: "host" certbot: image: certbot/certbot restart: unless-stopped volumes:
- ./data/certbot/conf:/etc/letsencrypt
- ./data/certbot/www:/var/www/certbot entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
Been struggling all day with getting this setup to work with two different subdomains which both need to accept https traffic (for a flask site/development site for same) - need to see if anyone has any insight. I'm getting the following errors when the first challenge is attempted while running the script, with some modifications.
On the first cert verification attempt:
In docker-compose up output - the reason nginx fails above, presumably?
My Desired Setup:
I've tried everything I could find from searching anything remotely related to the issue and suspect it's more a fundamental "not understanding NGINX config" issue on my part than a bug, but I hope someone can help and this question can be a reference for anyone else similarly stuck. I think there might be a solution in the nginx.conf file, having to do with adding some upstream entries, possibly, but I don't quite understand where to begin.
All my code is below, thank you in advance!
my nginx.conf
my init-letsencrypt.sh
my docker-compose
my 'web' container dockerfile
my 'web-dev' container dockerfile