mirror of
https://github.com/maplibre/martin.git
synced 2024-12-23 23:11:40 +03:00
82 lines
2.4 KiB
Nginx Configuration File
82 lines
2.4 KiB
Nginx Configuration File
|
|
user nginx;
|
|
worker_processes auto;
|
|
|
|
error_log /var/log/nginx/error.log notice;
|
|
pid /var/run/nginx.pid;
|
|
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
|
|
access_log /var/log/nginx/access.log main;
|
|
|
|
sendfile on;
|
|
tcp_nopush on;
|
|
|
|
keepalive_timeout 65;
|
|
|
|
gzip on;
|
|
gzip_vary on;
|
|
gzip_proxied any;
|
|
gzip_comp_level 6;
|
|
gzip_buffers 16 8k;
|
|
gzip_http_version 1.1;
|
|
gzip_min_length 256;
|
|
gzip_types text/plain text/css text/xml text/javascript application/x-javascript
|
|
application/xml application/javascript application/json application/x-protobuf;
|
|
|
|
proxy_cache_path /var/cache/nginx/
|
|
levels=1:2
|
|
max_size=10g
|
|
inactive=60m
|
|
use_temp_path=off
|
|
keys_zone=tiles_cache:10m;
|
|
|
|
upstream martin_upstream {
|
|
server martin:3000;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
resolver 127.0.0.11;
|
|
|
|
location ~ /tiles/(?<fwd_path>.*) {
|
|
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-Host $host;
|
|
proxy_set_header X-Rewrite-URL $uri;
|
|
proxy_redirect off;
|
|
|
|
proxy_connect_timeout 15m;
|
|
proxy_send_timeout 15m;
|
|
proxy_read_timeout 15m;
|
|
send_timeout 15m;
|
|
|
|
proxy_cache tiles_cache;
|
|
proxy_cache_lock on;
|
|
proxy_cache_revalidate on;
|
|
|
|
# Set caching time for responses
|
|
proxy_cache_valid 200 204 302 1h;
|
|
proxy_cache_valid 404 1m;
|
|
|
|
proxy_cache_use_stale error timeout http_500 http_502 http_503 http_504;
|
|
add_header X-Cache-Status $upstream_cache_status;
|
|
|
|
proxy_pass http://martin_upstream/$fwd_path$is_args$args;
|
|
}
|
|
}
|
|
}
|