From cd73f910216765542d0d97d01f7795768a48ac34 Mon Sep 17 00:00:00 2001 From: Conrad Schulz Date: Sat, 30 May 2026 17:15:44 +0000 Subject: [PATCH] feat: migrate from TileServer-GL to Martin - docker-compose: ghcr.io/maplibre/martin:v1.10.1, Port 3000 - config/martin.yaml: Auto-Discovery MBTiles/Styles/Sprites/Fonts, CORS built-in - nginx-Container entfernt (NPM uebernimmt Proxy/SSL/Routing) - config/config.json + nginx/ entfernt (TileServer-GL Artefakte) - docs: alle Endpunkt-URLs auf Martin-Format aktualisiert - .github/copilot-instructions.md: Stack auf Martin (Rust) aktualisiert - Vorteile: Hot-Reload, CORS built-in, ~10x weniger RAM --- .env.example | 3 +- .github/copilot-instructions.md | 37 ++++++++++--------- config/config.json | 29 --------------- config/martin.yaml | 43 ++++++++++++++++++++++ docker-compose.yml | 31 +++++----------- docs/api-endpoints.md | 64 +++++++++++++++++---------------- docs/homeassistant-config.md | 43 ++++++++++------------ docs/mediawiki-config.php | 31 ++++++++-------- docs/nextcloud-config.md | 30 ++++++++-------- nginx/cors.conf | 4 --- nginx/nginx.conf | 53 --------------------------- 11 files changed, 159 insertions(+), 209 deletions(-) delete mode 100644 config/config.json create mode 100644 config/martin.yaml delete mode 100644 nginx/cors.conf delete mode 100644 nginx/nginx.conf diff --git a/.env.example b/.env.example index 688d241..7bd1754 100644 --- a/.env.example +++ b/.env.example @@ -1,2 +1,3 @@ # Beispiel – in .env kopieren und anpassen -TILE_PORT=8080 +# Kein TILE_PORT mehr noetig – Martin laeuft direkt auf Port 3000 +# NPM (Nginx Proxy Manager) uebernimmt SSL und Routing diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 4827f7c..ee53e29 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -5,32 +5,31 @@ Selbst gehosteter Tile-Server (rd13) – stellt Karten-Tiles (OSM Vektor + Satel für interne Dienste bereit: MediaWiki (Kartographer), Nextcloud Maps, Home Assistant und weitere Web-Apps. ## Stack -- Language: Shell (Bash/Fish), JSON, Nginx config -- Infrastructure: Docker Compose, TileServer-GL (Node.js), nginx +- Language: Shell (Bash/Fish), YAML, JSON +- Infrastructure: Docker Compose, Martin (Rust), Nginx Proxy Manager (System-Proxy) - Data: MBTiles / PMTiles (OpenMapTiles-Schema), Planetiler (Java) -- Map styles: MapLibre GL / Mapbox GL JSON -- Reverse Proxy: nginx mit CORS + Rate-Limiting +- Map styles: MapLibre GL JSON (client-seitiges Rendering) +- Reverse Proxy: Nginx Proxy Manager (extern, SSL, Routing) – kein eigener nginx-Container ## Architecture - Pattern: Single-purpose service (tile serving only) -- `tileserver` Container: TileServer-GL rendert Tiles aus MBTiles-Dateien -- `nginx` Container: CORS-Header, Rate-Limiting, Caching-Header, externer Endpunkt +- `martin` Container: Rust-basierter Tile-Server, serviert Vektor- und Raster-Tiles aus MBTiles/PMTiles +- Kein nginx-Sidecar – CORS via Martin built-in, Proxy/SSL via NPM - Kartendaten liegen in `data/` (nicht im Git, da mehrere GB) -- Styles in `data/styles/`, Fonts in `data/fonts/` +- Styles in `data/styles/`, Fonts in `data/fonts/`, Sprites in `data/sprites/` - Key constraints: - MBTiles/PMTiles nie ins Git committen (.gitignore) - Secrets immer via `.env` (`.env` selbst auch ignoriert) - - CORS muss für alle Dienste im LAN offen sein (internes Netz) + - CORS via Martin-Config (alle Origins erlaubt für LAN) ## Conventions - Branch naming: `feat/`, `fix/` - Commit format: Conventional Commits (`feat|fix|chore|docs|refactor|ci`) - File structure: ``` - config/ TileServer-GL config.json + config/ Martin-Konfiguration (martin.yaml) data/ MBTiles, Fonts, Sprites, Styles (nicht im Git) docs/ Integrations-Anleitungen (MediaWiki, Nextcloud, Home Assistant, API) - nginx/ nginx.conf, cors.conf prompts/ GitHub Copilot Prompt-Templates scripts/ Daten-Download, Deploy-Hilfen ``` @@ -40,30 +39,34 @@ für interne Dienste bereit: MediaWiki (Kartographer), Nextcloud Maps, Home Assi ### Before starting any task 1. `docker compose config` – Syntax validieren -2. `docker compose logs tileserver` – laufende Fehler prüfen +2. `docker compose logs martin` – laufende Fehler prüfen 3. Impact analysis – betrifft die Änderung CORS, Caching oder Endpunkt-URLs? 4. Test strategy – mit curl / Browser gegen lokalen Server testen ### Definition of Done (DoD) - [ ] `docker compose config` fehlerfrei - [ ] Server startet ohne Fehler in den Logs -- [ ] Tile-Endpunkt antwortet (`curl http://localhost:PORT/health`) +- [ ] Tile-Endpunkt antwortet (`curl http://localhost:3000/health`) - [ ] CORS-Header korrekt gesetzt (prüfen mit `curl -I -H "Origin: ..."`) - [ ] Keine Secrets in docker-compose.yml oder Configs - [ ] .gitignore schützt MBTiles und .env - [ ] Commit message folgt Conventional Commits ## Tile-Server spezifische Hinweise -- Styles müssen auf `http://localhost:8080` zeigen (intern) – nginx setzt öffentliche URL +- Martin serviert Tiles direkt aus MBTiles/PMTiles – kein server-seitiges Rendering +- Clients (MediaWiki, Nextcloud, HA) rendern OSM-Vektorkacheln via MapLibre GL im Browser +- Satellit-Raster-Tiles (PNG) werden direkt aus raster MBTiles durchgereicht +- Hot-Reload: neue `.mbtiles`-Datei in `data/` ablegen → sofort unter `/catalog` sichtbar - Zoom-Level 0–14 reichen für die meisten Anwendungsfälle (Dateigröße vs. Detail) - Planetiler benötigt min. 4 GB RAM für Deutschland, 8 GB für Europa - Satellitenkacheln: kostenfrei nur bis Zoom 10 (NASA GIBS oder maptiler.com) -- TileJSON-Endpoints: `/styles/{name}.json` und `/data/{name}.json` +- TileJSON-Endpoints: `/{source_id}` z.B. `/osm`, `/satellite` +- Katalog aller geladenen Sources: `/catalog` ## Security -- Keine Secrets in config.json oder nginx.conf -- nginx Rate-Limiting aktiv halten (100r/s, Burst 200) -- Ports: nginx nach außen, tileserver nur intern (expose, nicht ports) +- Keine Secrets in martin.yaml oder docker-compose.yml +- NPM Rate-Limiting aktiv halten +- Port 3000 nur intern exponieren wenn NPM im selben Docker-Netz läuft - CORS auf `*` ist für internes LAN akzeptabel – für public deployment einschränken ## Non-Functional Requirements diff --git a/config/config.json b/config/config.json deleted file mode 100644 index b848d4b..0000000 --- a/config/config.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "options": { - "paths": { - "root": "", - "fonts": "fonts", - "sprites": "sprites", - "styles": "styles", - "mbtiles": "" - }, - "serveAllFonts": true, - "serveAllStyles": true - }, - "data": { - "osm-openmaptiles": { - "mbtiles": "osm.mbtiles" - }, - "satellite": { - "mbtiles": "satellite.mbtiles" - } - }, - "styles": { - "osm-bright": { - "style": "styles/osm-bright/style.json" - }, - "satellite-hybrid": { - "style": "styles/satellite-hybrid/style.json" - } - } -} diff --git a/config/martin.yaml b/config/martin.yaml new file mode 100644 index 0000000..6f67a96 --- /dev/null +++ b/config/martin.yaml @@ -0,0 +1,43 @@ +# Martin Tile Server – Konfiguration +# Dokumentation: https://maplibre.org/martin/ + +listen_addresses: "0.0.0.0:3000" +keep_alive: 75 +worker_processes: 4 +preferred_encoding: gzip + +# CORS – erlaubt Zugriff von allen LAN-Diensten (MediaWiki, Nextcloud, Home Assistant) +# Fuer public deployment: origins auf eigene Domains einschraenken +cors: + allowed_origins: + - "*" + allowed_methods: + - GET + - OPTIONS + allowed_headers: + - "*" + +# Auto-Discovery: alle *.mbtiles und *.pmtiles aus /data laden +# osm.mbtiles -> Source-ID: osm -> /{z}/{x}/{y} unter /osm/ +# satellite.mbtiles -> Source-ID: satellite -> /{z}/{x}/{y} unter /satellite/ +mbtiles: + paths: + - /data + +# MapLibre GL Styles aus /data/styles/ servieren +# -> GET /styles/{id} (Style-JSON fuer MapLibre GL Clients) +styles: + paths: + - /data/styles + +# Sprites (Icons, Pins, Marker) aus /data/sprites/ +# -> GET /sprites/{id}.json und /sprites/{id}.png +sprites: + paths: + - /data/sprites + +# Schriftarten fuer Karten-Labels +# -> GET /fonts/{font_name}/{start}-{end}.pbf +fonts: + paths: + - /data/fonts diff --git a/docker-compose.yml b/docker-compose.yml index 3095b30..1f5220b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,30 +1,17 @@ services: - tileserver: - image: maptiler/tileserver-gl:latest - container_name: rd13_tileserver - expose: - - "8080" + martin: + image: ghcr.io/maplibre/martin:v1.10.1 + container_name: rd13_martin + ports: + - "3000:3000" volumes: - ./data:/data - - ./config/config.json:/data/config.json:ro - command: ["--config", "/data/config.json", "--port", "8080", "--verbose"] + - ./config/martin.yaml:/config/martin.yaml:ro + command: ["--config", "/config/martin.yaml"] restart: unless-stopped healthcheck: - test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:8080/health"] + test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:3000/health"] interval: 30s timeout: 10s retries: 3 - start_period: 20s - - nginx: - image: nginx:alpine - container_name: rd13_tileserver_proxy - ports: - - "${TILE_PORT:-8080}:80" - volumes: - - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro - - ./nginx/cors.conf:/etc/nginx/cors.conf:ro - depends_on: - tileserver: - condition: service_healthy - restart: unless-stopped + start_period: 10s diff --git a/docs/api-endpoints.md b/docs/api-endpoints.md index f9ae706..f99d58f 100644 --- a/docs/api-endpoints.md +++ b/docs/api-endpoints.md @@ -1,44 +1,46 @@ -# Allgemeine Tile-Server Endpunkte +# Martin Tile Server – Endpunkte # -# Sobald der Server läuft, sind folgende Endpoints verfügbar: +# Sobald der Server laeuft (Port 3000, via NPM erreichbar): # -# Web-Interface: -# http://SERVER:PORT/ +# Health-Check: +# http://SERVER:3000/health # -# Styles (Raster-Tiles, PNG): -# http://SERVER:PORT/styles/osm-bright/{z}/{x}/{y}.png ← OSM -# http://SERVER:PORT/styles/satellite-hybrid/{z}/{x}/{y}.png ← Satellit -# http://SERVER:PORT/styles/osm-bright/{z}/{x}/{y}@2x.png ← Retina +# Katalog aller geladenen Sources (MBTiles/PMTiles): +# http://SERVER:3000/catalog # -# Daten (Vektor-Tiles, PBF): -# http://SERVER:PORT/data/osm-openmaptiles/{z}/{x}/{y}.pbf -# http://SERVER:PORT/data/satellite/{z}/{x}/{y}.png +# Vektor-Tiles (OSM, OpenMapTiles-Schema – PBF): +# http://SERVER:3000/osm/{z}/{x}/{y} +# TileJSON-Metadaten: http://SERVER:3000/osm # -# TileJSON (Metadaten für Leaflet, MapLibre, etc.): -# http://SERVER:PORT/styles/osm-bright.json -# http://SERVER:PORT/data/osm-openmaptiles.json +# Raster-Tiles (Satellit – PNG, direkt aus raster MBTiles): +# http://SERVER:3000/satellite/{z}/{x}/{y} +# TileJSON-Metadaten: http://SERVER:3000/satellite # -# WMTS (für QGIS, ArcGIS, etc.): -# http://SERVER:PORT/styles/osm-bright/wmts +# MapLibre GL Style (fuer Clients die selbst rendern): +# http://SERVER:3000/styles/osm-bright +# http://SERVER:3000/styles/satellite-hybrid # -# Leaflet.js Beispiel: -# L.tileLayer('http://SERVER:PORT/styles/osm-bright/{z}/{x}/{y}.png', { -# attribution: '© OpenMapTiles © OpenStreetMap contributors', -# maxZoom: 20 -# }).addTo(map); +# Sprites (Icons, Pins, eigene Marker): +# http://SERVER:3000/sprites/default.json +# http://SERVER:3000/sprites/default.png # -# MapLibre GL Beispiel: +# Fonts (Karten-Labels): +# http://SERVER:3000/fonts/{font_name}/{start}-{end}.pbf +# +# MapLibre GL – Style direkt einbinden (empfohlen fuer alle Clients): # new maplibregl.Map({ -# style: 'http://SERVER:PORT/styles/osm-bright.json', +# style: 'http://SERVER:3000/styles/osm-bright', # container: 'map' # }); # -# Home Assistant – configuration.yaml: -# map: -# lovelace card (custom:map-card oder built-in): -# tile_layer_url: 'http://SERVER:PORT/styles/osm-bright/{z}/{x}/{y}.png' -# tile_layer_attribution: '© OpenMapTiles © OpenStreetMap contributors' +# Leaflet.js – Raster-Tiles (Satellit): +# L.tileLayer('http://SERVER:3000/satellite/{z}/{x}/{y}', { +# attribution: 'Sentinel-2 cloudless', +# maxZoom: 14 +# }).addTo(map); # -# Für Home Assistant custom:map-card (HACS): -# tile_layer_url: 'http://SERVER:PORT/styles/osm-bright/{z}/{x}/{y}.png' -# tile_layer_max_zoom: 19 +# Home Assistant custom:map-card – Satellit (Raster, direkt nutzbar): +# tile_layer_url: 'http://SERVER:3000/satellite/{z}/{x}/{y}' +# +# NPM Advanced Config (Caching-Header, einmalig eintragen): +# add_header Cache-Control "public, max-age=86400, stale-while-revalidate=3600" always; diff --git a/docs/homeassistant-config.md b/docs/homeassistant-config.md index 88c8c44..964a6e4 100644 --- a/docs/homeassistant-config.md +++ b/docs/homeassistant-config.md @@ -1,26 +1,20 @@ # Home Assistant – eigenen Tile-Server verwenden # -# Home Assistant kann über mehrere Wege eigene Karten-Tiles nutzen. +# Martin liefert Raster-Tiles (Satellit) direkt als PNG – ideal fuer HA. +# OSM-Vektorkarten werden ueber MapLibre GL Style eingebunden. # # ------------------------------------------------------------------------- -# Option 1: Map Card (Standard Lovelace) +# Option 1: Map Card (Standard Lovelace) – Satellit (Raster, sofort nutzbar) # ------------------------------------------------------------------------- -# In einer Lovelace-Dashboard-Karte (type: map) wird der Tile-Server über -# ein custom Frontend-Modul eingebunden. Die eingebaute Map-Card unterstützt -# ab HA 2024.x direkt eigene Tile-Layer: -# -# Lovelace YAML (Dashboard → Karte bearbeiten → YAML-Modus): -# # type: map # entities: # - person.YOUR_PERSON # default_zoom: 12 -# # Tile Layer Override (ab HA 2024.6+): -# tile_layer: http://TILE_SERVER_URL:8080/styles/osm-bright/{z}/{x}/{y}.png -# tile_layer_attribution: "© OpenMapTiles © OpenStreetMap contributors" +# tile_layer: https://TILE_SERVER_URL/satellite/{z}/{x}/{y} +# tile_layer_attribution: "Sentinel-2 cloudless" # ------------------------------------------------------------------------- -# Option 2: custom:map-card (HACS) +# Option 2: custom:map-card (HACS) – Satellit # ------------------------------------------------------------------------- # https://github.com/nathan-gs/ha-map-card # @@ -28,25 +22,26 @@ # x: 48.137 # y: 11.576 # zoom: 12 -# tile_layer_url: "http://TILE_SERVER_URL:8080/styles/osm-bright/{z}/{x}/{y}.png" -# tile_layer_attribution: "© OpenMapTiles © OpenStreetMap contributors" -# tile_layer_max_zoom: 19 +# tile_layer_url: "https://TILE_SERVER_URL/satellite/{z}/{x}/{y}" +# tile_layer_attribution: "Sentinel-2 cloudless" +# tile_layer_max_zoom: 14 # entities: # - entity: person.YOUR_PERSON # ------------------------------------------------------------------------- -# Option 3: Satellitenkarte als alternativer Layer +# Option 3: custom:map-card – OSM via MapLibre GL Style # ------------------------------------------------------------------------- # type: custom:map-card -# tile_layer_url: "http://TILE_SERVER_URL:8080/styles/satellite-hybrid/{z}/{x}/{y}.png" -# tile_layer_attribution: "© OpenMapTiles © Sentinel-2" +# tile_layer_url: "https://TILE_SERVER_URL/osm/{z}/{x}/{y}" +# tile_layer_attribution: "© OpenMapTiles © OpenStreetMap contributors" +# tile_layer_max_zoom: 19 # ------------------------------------------------------------------------- # Hinweise # ------------------------------------------------------------------------- -# - TILE_SERVER_URL ersetzen mit der IP/Hostname des Tile-Servers im LAN -# - Port 8080 ist Standard (nginx-Proxy), anpassen falls abweichend -# - CORS ist bereits für das gesamte LAN (Origin: *) konfiguriert -# - Home Assistant muss den Tile-Server über HTTP im LAN erreichen können -# - Für HTTPS-Setups: Tile-Server ebenfalls über HTTPS erreichbar machen -# (z.B. über nginx Reverse Proxy mit SSL-Terminierung) +# - TILE_SERVER_URL = oeffentliche URL via NPM (kein Port noetig bei HTTPS) +# - Satellit (Raster-PNG) ist direkt nutzbar ohne MapLibre GL +# - OSM-Vektorkacheln: HA rendert sie nicht nativ – Raster-Tiles oder +# MapLibre GL Style-Einbindung ueber custom:map-card verwenden +# - CORS ist via Martin built-in konfiguriert (alle Origins erlaubt) +# - Fuer HTTPS: NPM uebernimmt SSL-Terminierung diff --git a/docs/mediawiki-config.php b/docs/mediawiki-config.php index bd24ecd..7878c61 100644 --- a/docs/mediawiki-config.php +++ b/docs/mediawiki-config.php @@ -1,35 +1,38 @@ -# MediaWiki Kartographer – Konfiguration für LocalSettings.php +# MediaWiki Kartographer – Konfiguration fuer LocalSettings.php # -# Füge diese Zeilen in deine LocalSettings.php ein. -# Ersetze TILE_SERVER_URL mit der tatsächlichen URL deines Servers. +# Fuelle diese Zeilen in deine LocalSettings.php ein. +# Ersetze TILE_SERVER_URL mit der oeffentlichen URL deines Servers (via NPM). # # Dokumentation: https://www.mediawiki.org/wiki/Extension:Kartographer +# +# Hinweis: Kartographer nutzt MapLibre GL im Browser – der Server liefert +# Vektor-Tiles und Style-JSON, das Rendering passiert client-seitig. # Kartographer aktivieren wfLoadExtension( 'Kartographer' ); -# Tile-Server URL (dein selbst gehosteter Server) -$wgKartographerMapServer = 'http://TILE_SERVER_URL:8080'; +# Tile-Server-Basis-URL (oeffentliche URL via NPM, kein Port noetig bei HTTPS) +$wgKartographerMapServer = 'https://TILE_SERVER_URL'; -# Welche Kartenstile stehen zur Verfügung? -# Die Namen entsprechen den Keys in config/config.json → "styles" +# Verfuegbare Kartenstile +# Die Namen entsprechen den Style-Dateien in data/styles/ $wgKartographerStyles = [ - 'osm-bright', # OpenStreetMap Vektorkarte - 'satellite-hybrid', # Satellitenkarte + 'osm-bright', # OpenStreetMap Vektorkarte (MapLibre GL) + 'satellite-hybrid', # Satellitenkarte ]; # Standard-Stil $wgKartographerDfltStyle = 'osm-bright'; -# Tile-URL-Muster für Raster-Tiles (XYZ) -# TileServer-GL stellt Tiles unter /styles/{style}/{z}/{x}/{y}.png bereit $wgKartographerSrcsetScales = [ 1, 1.5, 2 ]; -# Optional: statische Kartenbilder für Vorschau (Mapshot) -# $wgKartographerStaticFullWidth = true; +# Tile-Endpunkte (Martin-Format): +# Vektor-Tiles: https://TILE_SERVER_URL/osm/{z}/{x}/{y} +# Satellit: https://TILE_SERVER_URL/satellite/{z}/{x}/{y} +# Style-JSON: https://TILE_SERVER_URL/styles/osm-bright # Beispiel-Verwendung in einem Wiki-Artikel: # # {"type":"Feature","geometry":{"type":"Point","coordinates":[11.576,48.137]}, -# "properties":{"title":"München","description":"Landeshauptstadt"}} +# "properties":{"title":"Muenchen","description":"Landeshauptstadt"}} # diff --git a/docs/nextcloud-config.md b/docs/nextcloud-config.md index a065f0f..00e2f66 100644 --- a/docs/nextcloud-config.md +++ b/docs/nextcloud-config.md @@ -3,25 +3,27 @@ # Nextcloud Maps App: https://apps.nextcloud.com/apps/maps # # Konfiguration in Nextcloud Admin-Panel: -# Einstellungen → Verwaltung → Maps → Tile server URL +# Einstellungen -> Verwaltung -> Maps -> Tile server URL # -# Tile-Server-URLs (TileServer-GL XYZ-Format): +# Tile-Server-URLs (Martin-Format): # -# OSM Vektorkarte (als Rasterbild gerendert): -# http://TILE_SERVER_URL:8080/styles/osm-bright/{z}/{x}/{y}.png +# OSM Vektorkarte (MapLibre GL Style – Nextcloud rendert client-seitig): +# https://TILE_SERVER_URL/styles/osm-bright # -# Satellitenkarte: -# http://TILE_SERVER_URL:8080/styles/satellite-hybrid/{z}/{x}/{y}.png +# Satellitenkarte (Raster-Tiles, direkt nutzbar): +# https://TILE_SERVER_URL/satellite/{z}/{x}/{y} # -# Rohe Vektorkacheln (OpenMapTiles Schema): -# http://TILE_SERVER_URL:8080/data/osm-openmaptiles/{z}/{x}/{y}.pbf +# Rohe Vektor-Tiles (OpenMapTiles-Schema): +# https://TILE_SERVER_URL/osm/{z}/{x}/{y} # -# Über occ (Kommandozeile) setzen: -# php occ config:app:set maps tileserverUrl \ -# --value="http://TILE_SERVER_URL:8080/styles/osm-bright/{z}/{x}/{y}.png" - -# Beispiel für docker-compose override wenn Nextcloud im selben Stack läuft: +# Ueber occ (Kommandozeile) setzen: +# php occ config:app:set maps tileserverUrl # --value="https://TILE_SERVER_URL/satellite/{z}/{x}/{y}" +# +# Hinweis: Fuer OSM als gerendertes Rasterbild nutze den Style-Endpunkt. +# Nextcloud Maps unterstuetzt MapLibre GL Styles ab Version 1.4+. +# +# Beispiel fuer docker-compose override wenn Nextcloud im selben Stack laeuft: # # nextcloud: # environment: -# MAPS_TILE_SERVER: "http://rd13_tileserver_proxy/styles/osm-bright/{z}/{x}/{y}.png" +# MAPS_TILE_SERVER: "http://rd13_martin:3000/styles/osm-bright" diff --git a/nginx/cors.conf b/nginx/cors.conf deleted file mode 100644 index a9e7fb3..0000000 --- a/nginx/cors.conf +++ /dev/null @@ -1,4 +0,0 @@ -# Shared CORS headers – included by nginx.conf -# Wird automatisch auf alle Responses angewendet. -# Für produktiven Betrieb kann Origin auf deine Domains eingeschränkt werden: -# add_header Access-Control-Allow-Origin "https://wiki.example.com" always; diff --git a/nginx/nginx.conf b/nginx/nginx.conf deleted file mode 100644 index 7a3759f..0000000 --- a/nginx/nginx.conf +++ /dev/null @@ -1,53 +0,0 @@ -worker_processes auto; -events { worker_connections 1024; } - -http { - include mime.types; - default_type application/octet-stream; - sendfile on; - keepalive_timeout 65; - - # Rate limiting – schützt vor Missbrauch durch externe Dienste - limit_req_zone $binary_remote_addr zone=tiles:10m rate=100r/s; - - server { - listen 80; - server_name _; - - # CORS für alle Clients (MediaWiki, Nextcloud, Home Assistant, etc.) - include /etc/nginx/cors.conf; - - location / { - limit_req zone=tiles burst=200 nodelay; - - proxy_pass http://tileserver:8080; - 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; - - # Tile-Caching-Header - proxy_hide_header Cache-Control; - add_header Cache-Control "public, max-age=86400, stale-while-revalidate=3600"; - - # CORS-Header (aus cors.conf) - add_header Access-Control-Allow-Origin "*" always; - add_header Access-Control-Allow-Methods "GET, OPTIONS" always; - add_header Access-Control-Allow-Headers "Origin, X-Requested-With, Content-Type, Accept" always; - } - - # CORS Preflight - location ~* \.(pbf|png|jpg|json)$ { - if ($request_method = OPTIONS) { - add_header Access-Control-Allow-Origin "*"; - add_header Access-Control-Allow-Methods "GET, OPTIONS"; - add_header Access-Control-Max-Age 86400; - return 204; - } - - proxy_pass http://tileserver:8080; - add_header Access-Control-Allow-Origin "*" always; - add_header Cache-Control "public, max-age=86400"; - } - } -}