wrolpi/docker/web/wrolpi.dev.conf

91 lines
1.7 KiB
Text

# Nginx config for the WROLPi services.
#
# App
#
location /favicon.ico {
alias /etc/nginx/favicon.ico;
}
location /apple-touch-icon.png {
alias /etc/nginx/icon.png;
}
location / {
# React APP with Controller fallback
proxy_pass http://app:3000;
proxy_intercept_errors on;
error_page 502 503 504 = @react_fallback;
rewrite $1 break;
}
location @react_fallback {
return 302 /controller/?fallback=true;
}
location /ws {
proxy_pass http://app:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
#
# Controller - system management API and UI
# All Controller endpoints are under /controller/*
#
location /controller {
rewrite ^/controller(.*)$ $1 break;
proxy_pass http://controller:8087;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
#
# Main API - handled by the API service (port 8081)
#
location /api {
proxy_pass http://api:8081;
rewrite /^api(.*)$ $1 break;
}
location /docs {
proxy_pass http://api:8081;
rewrite /^docs(.*)$ $1 break;
}
location /media {
# The media files mounted in the docker volume
sendfile on;
sendfile_max_chunk 1m;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
autoindex on;
autoindex_exact_size off;
alias /opt/media;
}
location /download {
# Assume any request here is to download a file from the media directory.
if ( $request_filename ~ '^.*/(.+)$' ) {
# Always include the filename for downloads.
add_header Content-Disposition 'attachment; filename="$1"';
}
sendfile on;
sendfile_max_chunk 1m;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
autoindex on;
autoindex_exact_size off;
alias /opt/media;
}