Commit
This commit is contained in:
@@ -1,32 +1,26 @@
|
|||||||
|
events {
|
||||||
|
worker_connections 1024;
|
||||||
|
}
|
||||||
|
|
||||||
http {
|
http {
|
||||||
|
include mime.types;
|
||||||
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
sendfile on;
|
||||||
|
keepalive_timeout 65;
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name localhost;
|
server_name localhost;
|
||||||
|
|
||||||
# Serve the React app
|
|
||||||
root /usr/share/nginx/html;
|
|
||||||
index index.html;
|
|
||||||
|
|
||||||
# Frontend routes (SPA)
|
|
||||||
location / {
|
location / {
|
||||||
try_files $uri /index.html;
|
root /usr/share/nginx/html;
|
||||||
|
index index.html index.htm;
|
||||||
}
|
}
|
||||||
|
|
||||||
# API routes (proxy to backend)
|
error_page 500 502 503 504 /50x.html;
|
||||||
location /api/ {
|
|
||||||
proxy_pass http://127.0.0.1:3001; # Forward API requests to backend
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_redirect off; # Disable automatic redirects by the backend (if any)
|
|
||||||
}
|
|
||||||
|
|
||||||
# Optional: Custom error handling
|
|
||||||
error_page 404 /404.html;
|
|
||||||
error_page 500 502 503 504 /50x.html;
|
|
||||||
location = /50x.html {
|
location = /50x.html {
|
||||||
root /usr/share/nginx/html;
|
root /usr/share/nginx/html;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user