File tree Expand file tree Collapse file tree 5 files changed +37
-7
lines changed
Expand file tree Collapse file tree 5 files changed +37
-7
lines changed Original file line number Diff line number Diff line change @@ -16,3 +16,8 @@ Thumbs.db
1616# Temporary
1717* .tmp
1818* .temp
19+
20+ # Project-specific configs (not part of universal image)
21+ docker-compose.livck * .yml
22+ .env.livck *
23+ LIVCK- * .md
Original file line number Diff line number Diff line change @@ -94,10 +94,11 @@ services:
9494 OPCACHE_JIT : tracing
9595 OPCACHE_JIT_BUFFER_SIZE : 200M
9696
97- # SSL
97+ # SSL (CERTBOT_DOMAINS auto-derived from APP_URL if not set)
98+ APP_URL : https://example.com/
9899 CERTBOT_ENABLED : " true"
99- CERTBOT_DOMAINS : example.com
100100 CERTBOT_EMAIL : admin@example.com
101+ # CERTBOT_DOMAINS: example.com # Optional - auto-derived from APP_URL
101102
102103 # Laravel
103104 LARAVEL_OPTIMIZE_ON_BOOT : " true"
@@ -202,12 +203,15 @@ NGINX_CLIENT_MAX_BODY_SIZE=200M
202203
203204# ## SSL/Certbot
204205` ` ` bash
206+ APP_URL=https://example.com/ # Auto-derived for CERTBOT_DOMAINS (strips protocol)
205207CERTBOT_ENABLED=true
206208CERTBOT_EMAIL=admin@example.com
207- CERTBOT_DOMAINS=example.com,www.example.com
209+ CERTBOT_DOMAINS=example.com # Optional - auto-derived from APP_URL if not set
208210CERTBOT_AUTO_RENEW=true
209211` ` `
210212
213+ **Auto-Detection:** If `CERTBOT_DOMAINS` is empty, it's automatically derived from `APP_URL` by removing protocol (`https://`) and trailing slash.
214+
211215# ## Laravel
212216` ` ` bash
213217LARAVEL_OPTIMIZE_ON_BOOT=true
Original file line number Diff line number Diff line change 33
44echo " [Init] Generating runtime configurations from ENV variables..."
55
6+ # #######################################
7+ # Auto-derive Nginx server_name from APP_URL
8+ # #######################################
9+ if [ -n " ${APP_URL} " ]; then
10+ # Extract domain from APP_URL (remove protocol and trailing slash)
11+ export NGINX_SERVER_NAME=$( echo " ${APP_URL} " | sed -E ' s~^https?://~~' | sed ' s~/$~~' )
12+ echo " [Init] Auto-derived server_name from APP_URL: ${NGINX_SERVER_NAME} "
13+ else
14+ # Fallback to catch-all
15+ export NGINX_SERVER_NAME=" ${NGINX_SERVER_NAME:- _} "
16+ echo " [Init] Using server_name: ${NGINX_SERVER_NAME} "
17+ fi
18+
619# #######################################
720# Socket Type Detection (используется für PHP-FPM UND Nginx)
821# #######################################
@@ -245,7 +258,7 @@ export APP_ENV=${APP_ENV:-production}
245258# FPM_PASS is already set at the top of the script
246259
247260# Substitute ENV variables in Laravel-optimized nginx config
248- envsubst ' ${NGINX_WEBROOT} ${FPM_PASS} ${APP_ENV} ${NGINX_GZIP} ${NGINX_GZIP_COMP_LEVEL} ${NGINX_GZIP_MIN_LENGTH} ${NGINX_FASTCGI_BUFFER_SIZE} ${NGINX_FASTCGI_BUFFERS} ${NGINX_FASTCGI_BUSY_BUFFERS_SIZE} ${NGINX_FASTCGI_CONNECT_TIMEOUT} ${NGINX_FASTCGI_SEND_TIMEOUT} ${NGINX_FASTCGI_READ_TIMEOUT}' \
261+ envsubst ' ${NGINX_SERVER_NAME} ${ NGINX_WEBROOT} ${FPM_PASS} ${APP_ENV} ${NGINX_GZIP} ${NGINX_GZIP_COMP_LEVEL} ${NGINX_GZIP_MIN_LENGTH} ${NGINX_FASTCGI_BUFFER_SIZE} ${NGINX_FASTCGI_BUFFERS} ${NGINX_FASTCGI_BUSY_BUFFERS_SIZE} ${NGINX_FASTCGI_CONNECT_TIMEOUT} ${NGINX_FASTCGI_SEND_TIMEOUT} ${NGINX_FASTCGI_READ_TIMEOUT}' \
249262 < /etc/templates/nginx-laravel.conf > /etc/nginx/http.d/default.conf
250263
251264echo " [Init] Configurations generated successfully!"
Original file line number Diff line number Diff line change @@ -15,9 +15,17 @@ if [ -z "${CERTBOT_EMAIL}" ] || [ "${CERTBOT_EMAIL}" = "admin@example.com" ]; th
1515 CERTBOT_EMAIL=" "
1616fi
1717
18+ # Auto-derive CERTBOT_DOMAINS from APP_URL if not set
1819if [ -z " ${CERTBOT_DOMAINS} " ] || [ " ${CERTBOT_DOMAINS} " = " example.com,www.example.com" ]; then
19- echo " [Certbot] WARNING: CERTBOT_DOMAINS not set or using default. SSL certificates will not be obtained."
20- exit 0
20+ if [ -n " ${APP_URL} " ]; then
21+ # Extract domain from APP_URL (remove protocol and trailing slash)
22+ CERTBOT_DOMAINS=$( echo " ${APP_URL} " | sed -E ' s~^https?://~~' | sed ' s~/$~~' )
23+ export CERTBOT_DOMAINS
24+ echo " [Certbot] Auto-derived domain from APP_URL: ${CERTBOT_DOMAINS} "
25+ else
26+ echo " [Certbot] WARNING: CERTBOT_DOMAINS not set or using default. SSL certificates will not be obtained."
27+ exit 0
28+ fi
2129fi
2230
2331# Setup Certbot cron for auto-renewal
Original file line number Diff line number Diff line change 55 listen 80 default_server;
66 listen [::]:80 default_server;
77
8- server_name _ ;
8+ server_name ${NGINX_SERVER_NAME} ;
99 root ${NGINX_WEBROOT};
1010 index index.php index.html;
1111
You can’t perform that action at this time.
0 commit comments