In the Nginx configuration, trying to load ssl_certificate dynamically but
using $ssl_server_name variable
ssl_certificate /etc/letsencrypt/live/$ssl_server_name/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/$ssl_server_name/privkey.pem; getting this permission errors
│2019/09/22 08:29:42 [error] 7714#7714: *3 cannot load certificate "/etc/letsencrypt/live/example.com/fullchain.pem": BIO_new_file() failed (SSL: error:0200100D:system library:fopen:Permission denied:fopen('/etc/letsencrypt/live/example.com/fullchain.pem','r') error:2006D002:BIO routines:BIO_new_file:system lib) while SSL handshaking, client: , server: 0.0.0.0:443
but without using variable, its working !
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; is there any way to load ssl_certificate based on server_name dynamically?
tried few reference but still unable to solve.
livecontains symlinks toarchive. When initially created,liveandarchiveare accessible only toroot. You need to allow the Nginx user (whatever it is for your OS) read access. That may be as simple as changing the permissions of those two directories. The linked answer in your question, also suggests running certbot as the Nginx user.