Skip to content

Instantly share code, notes, and snippets.

@reyemtm
Last active November 20, 2024 14:06
Show Gist options
  • Save reyemtm/8e24661b6c3d1d2aa8ad8c13d5a2b858 to your computer and use it in GitHub Desktop.
Save reyemtm/8e24661b6c3d1d2aa8ad8c13d5a2b858 to your computer and use it in GitHub Desktop.
open-stack-nginx-conf
events {}
http {
# Proxy cache configuration (can be disabled if unnecessary)
proxy_cache_path /var/www/cache levels=1:2 keys_zone=tile-cache:100m max_size=1000m inactive=120m;
proxy_temp_path /var/www/cache/tmp;
server {
listen 80;
server_name localhost;
# Enable gzip compression
gzip on;
gzip_proxied any;
gzip_types
text/css
text/javascript
text/xml
text/plain
application/javascript
application/x-javascript
application/geo+json
application/json;
location /uptime/ {
proxy_pass http://uptime-kuma:3001/;
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;
}
# Endpoint: /tiles (served by tileserv)
location /tiles {
add_header X-Cache-Status $upstream_cache_status;
add_header X-Cache-Date $upstream_http_date;
proxy_pass http://pg_tileserv:7800/tiles;
proxy_http_version 1.1;
proxy_set_header Connection keep-alive;
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 http;
proxy_set_header Accept-Encoding "";
proxy_cache tile-cache;
proxy_cache_bypass $cookie_nocache $arg_nocache;
proxy_cache_valid 200 302 10m;
proxy_cache_valid 404 1m;
}
# Endpoint: /features (served by featureserv)
location /features/ {
expires 10m;
add_header Pragma public;
add_header Cache-Control "public";
add_header X-Cache-Status $upstream_cache_status;
add_header X-Cache-Date $upstream_http_date;
rewrite ^/features/(.*)$ /$1 break;
proxy_pass http://pg_featureserv:9000/;
proxy_http_version 1.1;
proxy_set_header Connection keep-alive;
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 http;
proxy_set_header Accept-Encoding "";
proxy_cache tile-cache;
proxy_cache_bypass $cookie_nocache $arg_nocache;
proxy_cache_valid 200 302 10m;
proxy_cache_valid 404 1m;
}
location = /features {
return 301 /features/; # Redirect requests without trailing slash to add it
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment