fastcgi_pass app:9000 legte die Adresse beim Start von nginx fest. Ein erneuter Deploy-Lauf nach einer Env-Änderung erzeugte die App mit neuer Adresse neu, den Web-Container nicht; Prod antwortete mit 502 (20.11.2026). Jetzt löst nginx den Namen über Dockers DNS (127.0.0.11, 10 s) bei Bedarf auf. Test hält die Konfiguration fest; DEPLOYMENT.md beschreibt das Ändern der Env-Datei. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.4 KiB
Plaintext
41 lines
1.4 KiB
Plaintext
server {
|
||
listen 80;
|
||
server_name _;
|
||
root /var/www/html/public;
|
||
index index.php;
|
||
|
||
# Dockers interner DNS: Der Name „app“ wird zur Laufzeit aufgelöst (höchstens 10 s zwischengespeichert), nicht
|
||
# einmal beim Start von nginx. Sonst zeigt nginx nach jeder Neuerzeugung des App-Containers (neue Adresse) auf die
|
||
# alte Adresse und antwortet mit 502 – etwa bei einem erneuten Deploy-Lauf nach einer Änderung der Env-Datei.
|
||
resolver 127.0.0.11 valid=10s ipv6=off;
|
||
|
||
client_max_body_size 2048m;
|
||
client_body_timeout 3600s;
|
||
send_timeout 3600s;
|
||
|
||
location / {
|
||
try_files $uri $uri/ /index.php?$query_string;
|
||
}
|
||
|
||
location ~ \.php$ {
|
||
set $php_upstream app:9000;
|
||
fastcgi_pass $php_upstream;
|
||
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
|
||
include fastcgi_params;
|
||
set $forwarded_proto $http_x_forwarded_proto;
|
||
if ($forwarded_proto = "") {
|
||
set $forwarded_proto $scheme;
|
||
}
|
||
fastcgi_param HTTP_X_FORWARDED_PROTO $forwarded_proto;
|
||
fastcgi_param HTTP_X_FORWARDED_HOST $http_x_forwarded_host if_not_empty;
|
||
fastcgi_param HTTP_X_FORWARDED_PORT $http_x_forwarded_port if_not_empty;
|
||
fastcgi_param HTTP_X_FORWARDED_FOR $proxy_add_x_forwarded_for;
|
||
fastcgi_read_timeout 3600s;
|
||
fastcgi_send_timeout 3600s;
|
||
}
|
||
|
||
location ~ /\.(?!well-known) {
|
||
deny all;
|
||
}
|
||
}
|