File tree Expand file tree Collapse file tree
custom-domain/dstack-ingress/scripts Expand file tree Collapse file tree Original file line number Diff line number Diff line change 106106setup_py_env
107107
108108setup_nginx_conf () {
109+ local cert_name
110+ cert_name=$( cert_dir_name " $DOMAIN " )
111+
109112 local client_max_body_size_conf=" "
110113 if [ -n " $CLIENT_MAX_BODY_SIZE " ]; then
111114 client_max_body_size_conf=" client_max_body_size ${CLIENT_MAX_BODY_SIZE} ;"
@@ -148,8 +151,8 @@ server {
148151 server_name ${DOMAIN} ;
149152
150153 # SSL certificate configuration
151- ssl_certificate /etc/letsencrypt/live/${DOMAIN } /fullchain.pem;
152- ssl_certificate_key /etc/letsencrypt/live/${DOMAIN } /privkey.pem;
154+ ssl_certificate /etc/letsencrypt/live/${cert_name } /fullchain.pem;
155+ ssl_certificate_key /etc/letsencrypt/live/${cert_name } /privkey.pem;
153156
154157 # Modern SSL configuration - TLS 1.2 and 1.3 only
155158 ssl_protocols TLSv1.2 TLSv1.3;
@@ -166,7 +169,7 @@ server {
166169 # Enable OCSP stapling
167170 ssl_stapling on;
168171 ssl_stapling_verify on;
169- ssl_trusted_certificate /etc/letsencrypt/live/${DOMAIN } /fullchain.pem;
172+ ssl_trusted_certificate /etc/letsencrypt/live/${cert_name } /fullchain.pem;
170173 resolver 8.8.8.8 8.8.4.4 valid=300s;
171174 resolver_timeout 5s;
172175
Original file line number Diff line number Diff line change @@ -112,6 +112,14 @@ sanitize_proxy_buffers() {
112112 fi
113113}
114114
115+ # Get the certbot certificate directory name for a domain.
116+ # Certbot stores wildcard certs without the "*." prefix:
117+ # *.example.com → /etc/letsencrypt/live/example.com/
118+ cert_dir_name () {
119+ local domain=" $1 "
120+ echo " ${domain# \* .} "
121+ }
122+
115123get_letsencrypt_account_path () {
116124 local base_path=" /etc/letsencrypt/accounts"
117125 local api_endpoint=" acme-v02.api.letsencrypt.org"
Original file line number Diff line number Diff line change 2323# Copy all certificate files
2424while IFS= read -r domain; do
2525 [[ -n " $domain " ]] || continue
26- cert_file=" /etc/letsencrypt/live/${ domain} /fullchain.pem"
26+ cert_file=" /etc/letsencrypt/live/$( cert_dir_name " $ domain" ) /fullchain.pem"
2727 if [ -f " $cert_file " ]; then
2828 cp " $cert_file " " cert-${domain} .pem"
2929 else
You can’t perform that action at this time.
0 commit comments