I've posted a related, but broader question in the Docker forum here, but I'll try to pare it down.
I'm following this guide for setting up Let's Encrypt with a Docker Nginx container.
I have the process working, but I had to deviate from the guide a bit. I want to make sure my final configurations are secure. I have two questions below these configuration files
Here is the final Nginx config from the guide:
server {
listen 80;
listen [::]:80;
server_name [domain-name] www.[domain-name];
server_tokens off;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://[domain-name]$request_uri;
}
}
server {
listen 443 default_server ssl http2;
listen [::]:443 ssl http2;
server_name [domain-name];
ssl_certificate /etc/nginx/ssl/live/[domain-name]/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/live/[domain-name]/privkey.pem;
location / {
proxy_pass http://[domain-name];
}
}
Here is the Docker Compose file from the guide:
version: '3'
services:
webserver:
image: nginx:latest
ports:
- 80:80
- 443:443
restart: always
volumes:
- ./nginx/conf/:/etc/nginx/conf.d/:ro
- ./certbot/www/:/var/www/certbot/:ro
certbot:
image: certbot/certbot:latest
volumes:
- ./certbot/www/:/var/www/certbot/:rw
- ./certbot/conf/:/etc/letsencrypt/:rw
Q1.) Is it safe to leave the location /.well-known/acme-challenge/ block in the Nginx config as it is in a production environment?
Q2.) Is it safe to leave the volume blocks in the Docker Compose config as they are in a production environment? Specifically, the ./certbot/www/:/var/www/certbot/:ro configuration in the Nginx block being able to be read by Nginx (and presumably anyone with the knowledge of how to browse there).
Thanks!