48 lines
1.5 KiB
Nginx Configuration File
48 lines
1.5 KiB
Nginx Configuration File
# Rate limiting zones
|
|
limit_req_zone $binary_remote_addr zone=tile_limit:10m rate=100r/s;
|
|
limit_req_zone $binary_remote_addr zone=api_limit:10m rate=30r/s;
|
|
|
|
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
|
|
# Gzip compression for better performance
|
|
gzip on;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
|
|
|
location / {
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Proxy API requests to the api service in docker
|
|
location /api/ {
|
|
limit_req zone=api_limit burst=20 nodelay;
|
|
proxy_pass http://api:3200/api/;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
proxy_set_header Host $host;
|
|
proxy_cache_bypass $http_upgrade;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
|
|
# Proxy Martin Vector Tiles (if accessed via dashboard directly)
|
|
location /tiles/ {
|
|
limit_req zone=tile_limit burst=50 nodelay;
|
|
proxy_pass http://martin:3000/;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
# Cache tiles for performance
|
|
add_header Cache-Control "public, max-age=3600";
|
|
}
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
}
|