Updated Configuring external web servers (markdown)

Lukas Rieger 2021-01-16 14:27:58 +01:00
parent 6e7c250f37
commit b8961b35cc

@ -1,4 +1,4 @@
If you don't like BlueMaps builtin webserver or you just need more advanced features, you can host BlueMap on external webservers like [NGINX](https://www.nginx.com/) or [Apache](https://httpd.apache.org/). For this to work you need to do some configuration:
If you want to optimize the speed of your map, you can also host BlueMap directly with external webservers like [NGINX](https://www.nginx.com/) or [Apache](https://httpd.apache.org/). For this to work you need to do some configuration:
## The goal
BlueMap renders and saves the map in a lot of small parts called "tiles". Those tiles are saved in individual files in a tree-like folder-structure here: `<webroot>/data/<map-id>/`. The file-data is in [json](https://www.json.org/json-de.html)-format. But the files are also compressed with [GZip](https://en.wikipedia.org/wiki/Gzip). The problem now is, that the web-app (browser) is asking for the uncompressed .json files, but a normal webserver only finds the compressed ones.
@ -9,6 +9,9 @@ BlueMap renders and saves the map in a lot of small parts called "tiles". Those
- Internally redirect the request to the .gz variant of the file
- Tell the browser that the file we send is actually GZip compressed and the browser has to decompress it before giving it to the web-app. *(We can do this with the [http-header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers) `Content-Encoding: gzip`)*
## Live data interface
If you are using a plugin/mod you usually have live-updating player-markers on your map. For those to work with an external web-server you will also need to reverse-proxy all requests to `/live/*` to the builtin web-server.
## NGINX
With NGINX it is actually only one config-line that does both things: `gzip_static always;`
@ -29,6 +32,11 @@ server {
location /data/ {
gzip_static always;
}
# Proxy requests to the live data interface to bluemaps integrated webserver
location /live/ {
proxy_pass http://localhost:8100;
}
}
```
@ -58,10 +66,10 @@ DocumentRoot /var/www/
</Directory>
```
*(this needs the HEADERS and REWRITE mods for Apache enabled)*
*(this needs the HEADERS and REWRITE mods for Apache enabled, and the reverse proxy for live data is missing)*
## Caddy
Here is a solution from [@mbround18](https://github.com/mbround18) if you are using [Caddy](https://caddyserver.com/). This example also has a proxy for `/live/*` included. *(See [Live updates](#live-updates) below)*
Here is a solution from [@mbround18](https://github.com/mbround18) if you are using [Caddy](https://caddyserver.com/):
```
http://your-domain {
root * /usr/share/caddy/
@ -83,10 +91,4 @@ http://your-domain {
}
}
```
## Live updates
If you are using a plugin/mod you usually have live- player-markers on your map. For those to work with an external web-server you will need to proxy requests to `/live/*` to the builtin web-server.
*(config examples for this are [WIP](https://en.wikipedia.org/wiki/Work_in_process) ^^)*
```