Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

2.7 KB
Raw Blame
worker_processes 2;

events {
    worker_connections 1024;
}

http {
    include mime.types;
    default_type application/octet-stream;
    sendfile on;

    keepalive_timeout 65;

    gzip on;
    gzip_proxied any;
    gzip_types application/vnd.mapbox-vector-tile application/x-protobuf application/json application/javascript;

    server {
        listen 80;
        server_name openinframap.org;

        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;

        location /tiles {
            if ($uri ~ "/tiles/[0-3]/") {
                expires 48h;
            }
            if ($uri ~ "/tiles/[4-6]/") {
                expires 4h;
            }
            if ($uri ~ "/tiles/[7-9]/") {
                expires 1h;
            }
            if ($uri ~ "/tiles/(10|11|12|13|14|15|16)/") {
                expires 10m;
            }
            proxy_pass http://oim-tileserver/maps/openinframap;
        }

        location ~ ^/map/([a-z_]+)/([0-6])/([0-9]+)/([0-9]+).pbf$ {
            expires 4h;
            proxy_pass http://oim-tileserver/maps/$1/$2/$3/$4.pbf;
        }

        location ~ ^/map/([a-z_]+)/([7-9])/([0-9]+)/([0-9]+).pbf$ {
            expires 1h;
            proxy_pass http://oim-tileserver/maps/$1/$2/$3/$4.pbf;
        }

        location ~ ^/map/([a-z_]+)/([0-9]+)/([0-9]+)/([0-9]+).pbf$ {
            expires 5m;
            proxy_pass http://oim-tileserver/maps/$1/$2/$3/$4.pbf;
        }

        location /heatmap.json {
            proxy_pass http://oim-web-backend;
        }

        location /heatmap {
            expires 12h;
            proxy_pass http://oim-tileserver/maps/solar_heatmap;
        }

        location /wikidata {
            proxy_pass http://oim-web-backend;
        }

        location /api {
            proxy_pass http://oim-web-backend;
        }

        location /search {
            proxy_pass http://oim-web-backend;
        }

        location /stats {
            proxy_pass http://oim-web-backend;
        }

        location /static {
            proxy_pass http://oim-web-backend;
        }

        location /copyright {
            proxy_pass http://oim-web-backend;
        }

        location /about.html {
            return 301 https://openinframap.org/about;
        }

        location /about {
            proxy_pass http://oim-web-backend;
        }

        location /sitemap.xml {
            proxy_pass http://oim-web-backend;
        }

        location / {
            proxy_pass http://oim-web;
        }
    }

    server {
        listen 80;
        server_name www.openinframap.org;
        return 301 https://openinframap.org$request_uri;
    }
}