Answer the question
In order to leave comments, you need to log in
Why does nginx from a Docker container not respond to certificates thrown into it?
Hey guys.
Please tell me how to diagnose the problem. Similarly to the specified tutorial https://medium.com/@marksta/this-was-so-useful-tha... I
registered a bunch of containers and launched the script for creating fake certificates. The only difference is in the nginx config (domen.ru - conditionally):
server {
listen 80;
server_name domen.ru;
server_tokens off;
root /public_html;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
}
server {
listen 443 ssl;
server_name domen.ru;
server_tokens off;
root /public_html;
ssl_certificate /etc/letsencrypt/live/domen.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domen.ru/privkey.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
location / {
index index.html;
}
}
version: '3'
services:
nginx:
image: nginx:1.15-alpine
restart: unless-stopped
volumes:
- ./public_html:/public_html
- ./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;\"'"
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;'"
docker exec nginx-certbot_nginx_1 ls /etc/letsencrypt/live/domen.ru;
docker-compose up -d;
docker exec nginx-certbot_certbot_1 certbot renew;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question