martin/frontend/nginx.conf

88 lines
2.5 KiB
Nginx Configuration File
Raw Normal View History

2018-10-08 14:03:04 +03:00
user nginx;
worker_processes auto;
worker_cpu_affinity auto;
pid /run/nginx.pid;
events {
worker_connections 4086;
use epoll;
multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
keepalive_requests 1000;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
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=backend_cache:10m;
2018-10-17 13:30:25 +03:00
upstream tiles_upstream {
server tiles:3000;
2018-10-08 14:03:04 +03:00
}
server {
listen 80;
server_name localhost;
resolver 127.0.0.11;
location / {
root /usr/share/nginx/html;
try_files $uri /index.html;
}
2018-10-17 13:30:25 +03:00
location ~ /tiles/(?<fwd_path>.*) {
2018-10-08 14:03:04 +03:00
proxy_set_header Host $host;
2018-10-25 01:41:40 +03:00
proxy_set_header X-Forwarded-Proto "https";
2018-10-08 14:03:04 +03:00
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 5m;
proxy_send_timeout 5m;
proxy_read_timeout 5m;
send_timeout 5m;
proxy_cache backend_cache;
proxy_cache_lock on;
proxy_cache_revalidate on;
proxy_cache_valid 200 204 302 1d;
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;
2018-10-17 13:30:25 +03:00
proxy_pass http://tiles_upstream/$fwd_path$is_args$args;
2018-10-08 14:03:04 +03:00
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}
}