Spaces:
Running
Running
# 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"; | |
} | |
} | |