Files
meta-sort/docker/nginx.conf
T

93 lines
2.7 KiB
Nginx Configuration File

worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
# Upstream servers
upstream api {
server 127.0.0.1:3000;
}
upstream rclone {
server 127.0.0.1:5572;
}
server {
listen 80;
server_name _;
# Static files (UI)
root /app/ui;
index index.html;
# SPA routing - serve index.html for any non-file request
location / {
try_files $uri $uri/ /index.html;
}
# Signed claims relay (plugins -> meta-sort -> meta-core). Exact match so
# a large claim batch is not cut at nginx's 1 MB default (the API takes
# up to 16 MB); reads of /api/meta/{cid}/claims use the /api/ block.
location = /api/claims {
client_max_body_size 16m;
proxy_pass http://api;
proxy_http_version 1.1;
proxy_set_header Host $host;
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;
}
# API routes
location /api/ {
proxy_pass http://api;
proxy_http_version 1.1;
proxy_set_header Host $host;
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;
}
# Health check (direct to API)
location /health {
proxy_pass http://api/health;
proxy_http_version 1.1;
proxy_set_header Host $host;
}
# rclone web UI
location /rclone/ {
proxy_pass http://rclone/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# Basic auth for rclone
auth_basic "rclone";
auth_basic_user_file /etc/nginx/.htpasswd;
}
}
}