Files
ExcaliDash/frontend/nginx.conf.template
T
Adrian Acala f9986513f8 Refactor nginx configuration and update README
- Moved BACKEND_URL configuration to the frontend service in the README.
- Added validation for the generated nginx configuration in the entrypoint script.
- Removed fallback nginx configuration copy from the Dockerfile.
- Adjusted nginx template to ensure proper header formatting.

This improves the deployment process and clarifies configuration instructions.
2025-11-29 11:29:43 -08:00

74 lines
2.4 KiB
Plaintext

events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_vary on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
# Set maximum request body size to 50MB to handle large drawings with embedded images
client_max_body_size 50M;
server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# API and WebSocket proxy to backend
# BACKEND_URL is substituted at container startup (default: backend:8000)
location /api/ {
proxy_pass http://${BACKEND_URL}/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Buffer and timeout settings for large payloads
proxy_buffering on;
proxy_buffer_size 4k;
proxy_buffers 8 4k;
proxy_busy_buffers_size 8k;
client_body_buffer_size 128k;
# Timeouts for large uploads (300 seconds)
proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
}
# WebSocket proxy for Socket.IO
location /socket.io/ {
proxy_pass http://${BACKEND_URL}/socket.io/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Frontend routes
location / {
try_files $uri $uri/ /index.html;
}
# Cache static assets
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
}
}
}