1
0
Files
breadcrumb-the-shire/deploy/nginx/site.conf
aminovfariz 2b230e756e fix(deploy): re-resolve php upstream on each request to survive container restarts
Using resolver 127.0.0.11 (Docker internal DNS) with set $php_upstream
forces nginx to re-resolve the php hostname dynamically instead of caching
the IP at startup — eliminates 502 after php container is recreated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-08 09:58:28 +02:00

42 lines
1.2 KiB
Plaintext

# Docker nginx — только HTTP (SSL терминируется на host nginx)
server {
listen 80;
server_name projects.breadcrumb-online.de;
client_max_body_size 10M;
root /var/www/web;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Docker DNS resolver — re-resolves php hostname on each request
resolver 127.0.0.11 valid=5s;
location ~ \.php$ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
# SSL терминирован на host nginx — передаём это в PHP
fastcgi_param HTTPS on;
fastcgi_param HTTP_X_FORWARDED_PROTO https;
set $php_upstream php:9000;
fastcgi_pass $php_upstream;
fastcgi_hide_header Cache-Control;
add_header Cache-Control "no-store, no-cache, must-revalidate, private" always;
}
location ~* \.mjs$ {
default_type application/javascript;
try_files $uri =404;
expires 30d;
access_log off;
}
location ~* \.(css|js|png|jpg|jpeg|gif|svg|ico|webp|woff2?)$ {
expires 30d;
access_log off;
}
}