Introduction
One plugin that’s good for Minecraft is a Map plugin. One way to implement that is by having it accessible from a website. The Plugin that I will be implementing will be BlueMap.
Adding the .jar Plugin
You can download the plugin from BlueMaps Github Release. I will be using v3.16. To get started, open a SSH connection to your paperMC VM and use wget to download the jar into the plugin folder
mc:~# cd minecraft/plugins/
mc:~/minecraft/plugins# wget https://github.com/BlueMap-Minecraft/BlueMap/releases/download/v3.16/BlueMap-3.16-spigot.jar
Connecting to github.com (140.82.114.3:443)
Connecting to objects.githubusercontent.com (185.199.110.133:443)
saving to 'BlueMap-3.16-spigot.jar'
BlueMap-3.16-spigot. 100% |*****************************************************************************************************| 4567k 0:00:00 ETA
'BlueMap-3.16-spigot.jar' saved
mc:~/minecraft/plugins# ls
BlueMap-3.16-spigot.jar bStats
mc:~/minecraft/plugins#
Stop the running background server with rc-service papermc stop
mc:~/minecraft/plugins# rc-service papermc stop
* Stopping papermc ... [ ok ]
mc:~/minecraft/plugins#
Run Minecraft manually as there will be an EULA for the plugin
mc:~/minecraft/plugins# cd ..
mc:~/minecraft# java -Xms2G -Xmx2G -jar paper.jar --nogui
Starting org.bukkit.craftbukkit.Main
System Info: Java 20 (OpenJDK 64-Bit Server VM 20.0.2+9-alpine-r0) Host: Linux 6.1.60-0-virt (amd64)
Loading libraries, please wait...
[01:03:06 INFO]: Environment: authHost='https://authserver.mojang.com', accountsHost='https://api.mojang.com', sessionHost='https://sessionserver.mojang.com', servicesHost='https://api.minecraftservices.com', name='PROD'
[01:03:08 INFO]: Loaded 7 recipes
[01:03:08 INFO]: Starting minecraft server version 1.20.1
...
[01:03:11 INFO]: [BlueMap] Loading...
[01:03:12 WARN]: [BlueMap] BlueMap is missing important resources!
[01:03:12 WARN]: [BlueMap] You must accept the required file download in order for BlueMap to work!
[01:03:12 WARN]: [BlueMap] Please check: /root/minecraft/plugins/BlueMap/core.conf
[01:03:12 INFO]: [BlueMap] If you have changed the config you can simply reload the plugin using: /bluemap reload
>
Edit the file plugins/BlueMap/core.conf
and change line 12 to True
. After that, you can restart the background service rc-service papermc start
After the server is back online, you can visit the Map via MincraftIP:8100
Adding Nginx to Alpine
Install Nginx in Alpine with the following commands
apk update
apk add nginx
Make a backup of the original nginx.conf file
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig
edit /etc/nginx/nginx.conf
to be the following
user root;
worker_processes auto; # it will be determinate automatically by the number of core
error_log /var/log/nginx/error.log warn;
#pid /var/run/nginx/nginx.pid; # it permit you to use /etc/init.d/nginx reload|restart|stop|start
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
access_log /var/log/nginx/access.log;
keepalive_timeout 3000;
server {
listen 80;
# path to bluemap-webroot, bluemap can also be used in a sub-folder .. just adapt the paths accordingly
root /root/minecraft/bluemap/web;
location ~* ^/maps/[^/]*/tiles/ {
# High-res tiles are stored as precompressed JSON with a fallback to returning an empty tile.
# Low-res tiles are stored as pngs with a fallback to returning 204 (No Content).
location ~* \.json$ {
error_page 404 =200 /assets/emptyTile.json;
gzip_static always;
}
location ~* \.png$ {
try_files $uri =204;
}
}
# OPTIONAL:
# Proxy requests for live data to the bluemaps integrated webserver.
# If you have multiple servers you will need to proxy each map-id to the correct server.
location ~* ^/maps/[^/]*/live/ {
proxy_pass http://127.0.0.1:8100;
}
}
}
test the nginx config file with the following nginx -t
, if it passes, you will get this below
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
After that, reload with rc-service nginx reload
You will be able to navigate to MinecraftIP:80,
and it will be able to run without Minecraft running in the background and way faster than before.
HTTPS Reverse Proxy with Caddy
With Caddy, add the following to enable auto SSL cert generation and HTTP to HTTPS redirect for bluemap
{
"apps": {
"http": {
"servers": {
"srv0": {
"listen": [
":443"
],
"routes": [
{
"match": [
{
"host": [
"mc.ata.al"
]
}
],
"handle": [
{
"handler": "subroute",
"routes": [
{
"handle": [
{
"handler": "reverse_proxy",
"upstreams": [
{
"dial": "10.0.210.102:80"
}
]
}
]
}
]
}
],
"terminal": true
}
]
}
}
}
}
}