Answer the question
In order to leave comments, you need to log in
Why can't volumes from letsencrypt by certbot be transferred to nginx's docker container?
Good afternoon,
I generated certificates that have rights - 777:
/etc/letsencrypt/live/domen.ru/cert.pem
/etc/letsencrypt/live/domen.ru/chain.pem
/etc/letsencrypt/live/domen.ru /fullchain.pem
/etc/letsencrypt/live/domen.ru/privkey.pem There is an nginx
configuration file :
server {
listen 443 ssl;
server_name www.domen.ru domen.ru;
charset utf-8;
index index.php;
root /var/www/public;
location / {
try_files $uri /index.php?$args;
}
location /docs {
try_files $uri $uri/;
}
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass php-fpm:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
ssl_certificate /etc/letsencrypt/live/domen.ru/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/domen.ru/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/domen.ru/chain.pem;
}
version: '3.7'
services:
nginx:
container_name: nginx
image: nginx:1.15-alpine
volumes:
- ./app:/var/www
- ./volumes/log/nginx/:/var/log/nginx/
- ./docker/app/nginx/prod/app.conf:/etc/nginx/conf.d/default.conf
- /etc/letsencrypt/live/domen.ru/:/etc/letsencrypt/live/domen.ru/
ports:
- ${HTTP_PORT}:80
- ${HTTPS_PORT}:443
restart: unless-stopped
depends_on:
- php-fpm
docker-compose up -d
docker ps
sudo docker-compose logs --tail="all" nginx;
Answer the question
In order to leave comments, you need to log in
Instead of a full path to
- /etc/letsencrypt/live/domen.ru/:/etc/letsencrypt/live/domen.ru/
services:
nginx:
# ...
volumes:
# ...
- /etc/letsencrypt:/etc/letsencrypt
live/domen.ru
the certificates themselves are not in it, but the links to the files are two levels higher. You can see the links, but they point to inaccessible files.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question