File size: 1,658 Bytes
7d6d833
a04c70d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7d6d833
 
 
a04c70d
 
 
 
7d6d833
a04c70d
 
 
 
 
 
7d6d833
 
a04c70d
 
 
 
 
7d6d833
 
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

worker_processes  auto;

error_log  /home/user/nginx/error.log warn;
pid        /home/user/nginx/nginx.pid;

events {
    worker_connections 1024;
}

http {
    # Include the default mime types (includes .wasm, .js, etc.).
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    client_body_temp_path /home/user/nginx/tmp/client_body;
    proxy_temp_path /home/user/nginx/tmp/proxy;
    fastcgi_temp_path /home/user/nginx/tmp/fastcgi;
    uwsgi_temp_path /home/user/nginx/tmp/uwsgi;
    scgi_temp_path /home/user/nginx/tmp/scgi;

    access_log /home/user/nginx/access.log;

    # Hide nginx version
    server_tokens off;

    sendfile        on;
    keepalive_timeout 65;

    # The main server block
    server {
        listen 8080 default_server;
        server_name _;

        # Serve the Unity WebGL build from /unity at the container root
        root /unity;
        index index.html;

        # Proxy /api/* to FastAPI running on localhost:3000
        location /api/ {
            proxy_pass         http://127.0.0.1:3000/;
            proxy_http_version 1.1;

            # For WebSocket/streaming support (if your FastAPI endpoints use it)
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";

            # Forward original Host header, useful for logs or domain-specific logic
            proxy_set_header Host $host;
        }

        # All other files are served from the Unity build
        # If file is not found, try returning index.html (useful for single-page apps)
        location / {
            try_files $uri $uri/ /index.html;
        }
    }
}