Skip to content

Add a guide for Caddy #113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 38 additions & 12 deletions wiki/webserver/NginxProxy.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
---
layout: page
title: Reverse-Proxy with NGINX
title: Reverse-Proxy with NGINX or Caddy
parent: Webserver
grand_parent: Wiki
nav_order: 3
---

# Reverse proxy BlueMap with NGINX
# Reverse proxy BlueMap with NGINX or Caddy

Here are some examples how you can use NGINX to reverse-proxy your BlueMap.
Here are some examples how you can use NGINX or Caddy to reverse-proxy your BlueMap.

This is useful if you want to integrate your map in your website, or want to add SSL-capabilities.

## Assumptions / Prerequisites
- You have access to your servers shell (not only the minecraft-console).
- You have NGINX already
[installed](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/).
- NGINX is running on the same machine as BlueMaps integrated webserver. *(If that is not the case you'll need to
- You have [NGINX](https://docs.nginx.com/nginx/admin-guide/installing-nginx/installing-nginx-open-source/) or [Caddy](https://caddyserver.com/docs/install) already
installed.
- NGINX or Caddy is running on the same machine as BlueMaps integrated webserver. *(If that is not the case you'll need to
replace `localhost` with the correct ip in the examples below)*
- BlueMaps integrated webserver is running on port `8100`. *(Again, just replace `8100` with the actual port below)*

> **Info:**<br>
> If you want, you can tell the internal-webserver to only connect to one specific address like e.g. `127.0.0.1`,
> so it is no longer accessible from the outside (by default it just connects to all available interfaces):
> so it is no longer accessible from the outside (by default it just connects to all available interfaces):
> To do this, just open the `webserver.conf` and add the `ip: "127.0.0.1"` setting somewhere.
{: .info }

## BlueMap on a subdirectory of your website
If you have a normal website hosted with NGINX and want your map on `/map` (e.g `https://mydomain.com/map`) then
you can just add this to your NGINX configuration:
If you have a normal website hosted with NGINX or Caddy and want your map on `/map` (e.g `https://mydomain.com/map`)

### NGINX
You can add the following to your NGINX config.
```nginx
server {

...

location /map/ {
Expand All @@ -40,9 +42,24 @@ server {
}
```

### Caddy

You can add the following to your Caddyfile.

```caddy
mydomain.com {
handle_path /map/* {
reverse_proxy 127.0.0.1:8100
}
}
```

## BlueMap on a subdomain
If you want BlueMap on a subdomain e.g. `https://map.mydomain.com/` then you'd add something like this to
your nginx config:
If you want BlueMap on a subdomain e.g. `https://map.mydomain.com/`

### NGINX
On NGINX you can add this to your config.

```nginx
server {
listen 80;
Expand All @@ -55,3 +72,12 @@ server {
}
}
```

### Caddy
You can add the following to your Caddyfile.

```caddy
map.mydomain.com {
reverse_proxy 127.0.0.1:8100
}
```