File size: 2,346 Bytes
3464008
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
worker_processes auto;
error_log /dev/stderr warn;
pid /tmp/nginx-outer.pid;

events {
  worker_connections 1024;
}

http {
  include       /etc/nginx/mime.types;
  default_type  application/octet-stream;

  log_format main '$remote_addr - [$time_local] "$request" $status $body_bytes_sent';
  access_log /dev/stdout main;

  sendfile on;
  keepalive_timeout 65;

  map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
  }

  client_body_temp_path /tmp/nginx-outer-client-body;
  proxy_temp_path /tmp/nginx-outer-proxy;
  fastcgi_temp_path /tmp/nginx-outer-fastcgi;
  uwsgi_temp_path /tmp/nginx-outer-uwsgi;
  scgi_temp_path /tmp/nginx-outer-scgi;

  server {
    listen 7860;

    # World Monitor (AGPL-3.0, github.com/koala73/worldmonitor) — self-hosted,
    # served by its own internal nginx on :8080, mounted under /worldmonitor/.
    location /worldmonitor/ {
      proxy_pass http://127.0.0.1:8080/;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_buffering off;
      proxy_read_timeout 120s;
      proxy_send_timeout 120s;
    }

    # World Monitor's own frontend makes some root-relative fetches (not aware
    # of the /worldmonitor/ mount prefix) — forward those through too.
    location /api/ {
      proxy_pass http://127.0.0.1:8080/api/;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_read_timeout 120s;
    }
    location /assets/       { proxy_pass http://127.0.0.1:8080/assets/; }
    location /data/         { proxy_pass http://127.0.0.1:8080/data/; }
    location /textures/     { proxy_pass http://127.0.0.1:8080/textures/; }
    location /map-styles/   { proxy_pass http://127.0.0.1:8080/map-styles/; }

    # Everything else — GenerAI (Python/FastAPI, uvicorn on :8000).
    location / {
      proxy_pass http://127.0.0.1:8000;
      proxy_http_version 1.1;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header Upgrade $http_upgrade;
      proxy_set_header Connection $connection_upgrade;
      proxy_buffering off;
      proxy_read_timeout 300s;
      proxy_send_timeout 300s;
    }
  }
}