Files
enerport-web-app/docker/nginx.conf
Murat Özkorkmaz 87dbd0ba44 Fixing logos
2025-11-13 20:16:21 +01:00

88 lines
2.0 KiB
Nginx Configuration File

worker_processes auto;
pid /tmp/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# Logging
access_log off;
error_log /dev/stderr warn;
# Performance
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
keepalive_requests 1000;
# Compression
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_min_length 256;
gzip_comp_level 6;
gzip_types
text/plain
text/css
text/xml
text/javascript
application/javascript
application/x-javascript
application/json
application/xml
application/xml+rss
font/ttf
font/otf
image/svg+xml;
server {
listen 8080;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# Redirect root to default locale (de) - using relative redirect
location = / {
return 301 $scheme://$http_host/de/;
}
# Serve logos directly from root (needed for i18n builds)
location ~ ^/logo-(dark|light)\.png$ {
try_files $uri =404;
expires 1y;
access_log off;
add_header Cache-Control "public, immutable";
}
# Serve each locale
location ~ ^/(de|de-DE|en)/ {
try_files $uri $uri/ /$1/index.html;
}
# Fallback for any other routes to default locale
location / {
return 301 $scheme://$http_host/de$request_uri;
}
# Static Assets Caching
location ~* \.(?:ico|css|js|gif|jpe?g|png|woff2?|eot|ttf|svg|map)$ {
expires 1y;
access_log off;
add_header Cache-Control "public, immutable";
}
# Optional: Explicit asset route
location /assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}
}