frappe_docker/nginx/conf.d/default.conf
2025-07-14 15:49:06 +03:00

67 lines
1.6 KiB
Text

# Default server configuration
upstream frappe-bench-frappe {
server backend:8000 fail_timeout=0;
}
upstream frappe-bench-socketio {
server websocket:9000 fail_timeout=0;
}
# HTTP server
server {
listen 80;
server_name _;
root /var/www/html/sites;
# Health check endpoint
location /health {
access_log off;
return 200 "healthy\n";
add_header Content-Type text/plain;
}
# Static files
location /assets {
try_files $uri =404;
add_header Cache-Control "max-age=31536000";
}
location ~ ^/protected/(.*) {
internal;
try_files /sites/$host/$1 =404;
}
# Socket.io
location /socket.io {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Frappe-Site-Name $host;
proxy_set_header Origin $scheme://$http_host;
proxy_set_header Host $host;
proxy_pass http://frappe-bench-socketio;
}
# Main application
location / {
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frappe-Site-Name $host;
proxy_set_header Host $host;
proxy_set_header X-Use-X-Accel-Redirect True;
proxy_read_timeout 120;
proxy_redirect off;
proxy_pass http://frappe-bench-frappe;
}
# Error pages
error_page 502 /502.html;
location = /502.html {
root /usr/share/nginx/html;
internal;
}
}