mirror of
https://github.com/mblanke/Lottery-Tracker.git
synced 2026-03-01 14:10:22 -05:00
78 lines
2.3 KiB
Nginx Configuration File
78 lines
2.3 KiB
Nginx Configuration File
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
upstream backend {
|
|
server backend:5000;
|
|
}
|
|
|
|
upstream frontend {
|
|
server frontend:3000;
|
|
}
|
|
|
|
# Rate limiting zone
|
|
limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s;
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
# Redirect HTTP to HTTPS (uncomment when SSL is configured)
|
|
# return 301 https://$host$request_uri;
|
|
|
|
# API reverse proxy
|
|
location /api/ {
|
|
limit_req zone=api burst=20 nodelay;
|
|
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;
|
|
proxy_read_timeout 120s;
|
|
}
|
|
|
|
# Frontend
|
|
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;
|
|
}
|
|
|
|
# Cache static assets
|
|
location /_next/static/ {
|
|
proxy_pass http://frontend;
|
|
proxy_cache_valid 200 365d;
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
}
|
|
}
|
|
|
|
# HTTPS server (uncomment when SSL certificates are in ./ssl/)
|
|
# server {
|
|
# listen 443 ssl;
|
|
# server_name your-domain.com;
|
|
#
|
|
# ssl_certificate /etc/nginx/ssl/cert.pem;
|
|
# ssl_certificate_key /etc/nginx/ssl/key.pem;
|
|
#
|
|
# location /api/ {
|
|
# limit_req zone=api burst=20 nodelay;
|
|
# 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;
|
|
# }
|
|
#
|
|
# 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;
|
|
# }
|
|
# }
|
|
}
|