56 lines
1.6 KiB
Nginx Configuration File
56 lines
1.6 KiB
Nginx Configuration File
|
|
events {
|
||
|
|
worker_connections 1024;
|
||
|
|
}
|
||
|
|
|
||
|
|
http {
|
||
|
|
upstream frontend {
|
||
|
|
server frontend:3000;
|
||
|
|
}
|
||
|
|
|
||
|
|
upstream backend {
|
||
|
|
server backend:8000;
|
||
|
|
}
|
||
|
|
|
||
|
|
server {
|
||
|
|
listen 80;
|
||
|
|
server_name localhost;
|
||
|
|
|
||
|
|
# Backend API routes
|
||
|
|
location /api/ {
|
||
|
|
proxy_pass http://backend;
|
||
|
|
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;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Backend static files
|
||
|
|
location /static/ {
|
||
|
|
proxy_pass http://backend;
|
||
|
|
proxy_set_header Host $host;
|
||
|
|
proxy_set_header X-Real-IP $remote_addr;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Backend stats dashboard (root of backend)
|
||
|
|
location /stats/ {
|
||
|
|
rewrite ^/stats/(.*)$ /$1 break;
|
||
|
|
proxy_pass http://backend;
|
||
|
|
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;
|
||
|
|
}
|
||
|
|
|
||
|
|
# Frontend (default)
|
||
|
|
location / {
|
||
|
|
proxy_pass http://frontend;
|
||
|
|
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;
|
||
|
|
proxy_set_header Upgrade $http_upgrade;
|
||
|
|
proxy_set_header Connection "upgrade";
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|