File size: 1,037 Bytes
9f242de
 
 
5eb5663
 
 
9f242de
 
 
 
 
 
deb090d
5d2f496
deb090d
 
 
 
 
 
 
 
 
 
9f242de
deb090d
9f242de
deb090d
 
 
 
 
 
9f242de
deb090d
 
 
 
9f242de
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
# Remove or comment out `user` directive if it's elsewhere
# user nginx;

error_log /app/logs/error.log warn;
access_log /app/logs/access.log;

client_body_temp_path /app/tmp/body;
proxy_temp_path       /app/tmp/proxy;
fastcgi_temp_path     /app/tmp/fastcgi;
uwsgi_temp_path       /app/tmp/uwsgi;
scgi_temp_path        /app/tmp/scgi;

server {
    listen 7860;

    # Root directory for the React app
    root /usr/share/nginx/html;
    index index.html index.htm;

    # Handle client-side routing for React
    location / {
        try_files $uri /index.html;
    }

    # Proxy API requests to the backend
    location /api {
        proxy_pass http://127.0.0.1:8000;
        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;
    }

    # Cache static assets
    location ~* \.(css|js|jpg|jpeg|png|gif|ico|svg)$ {
        expires 1y;
        add_header Cache-Control "public";
    }
}