You will need to create a virtual host within Apache first and make sure that it responds. This is not the scope of this article to do this. There are many article that tell you how to setup a virtual host in Apache. I also don’t go over any SELinux settings.
You will need Dynmap plugin installed and the server at least started once for the configuration files to be created.
This is how I setup Dynmap Minecraft mapping plugin to use Apache HTTP Server instead of the built in HTTP server. This isn’t a hand walk how-to but a post to remind myself of how I did it. I highly recommend this configuration over using the built in HTTP server or using proxy methods. I observed better performance on both the loading of tiles and the Minecraft server.
Hostname: minecraft.server.example
Web Site Path: /home/user/public_html
Minecraft Server Path: /home/user/minecraftserver/plugins/dynmap
First thing to do is shutdown the Minecraft server. This is to avoid any issues with the tiles being written or updated while being copied.
Next, copy the /home/user/minecraftserver/plugins/dynmap/web directory to the /home/user/public_html directory. There is caveats to this. Depending on how large your world is, Dynmap can (and will) create millions of files for the map. The copy command can take a very long time depending on how large your world is. (It took 3 hours for one of my servers.)
cp -R /home/user/minecraftserver/plugins/dynmap/web /home/user/public_html
Once the copy is complete, rename the new folder in the public_html directory to dynmap.
cd /home/user/public_html
mv web dynmap
Change file permissions on the files so that Apache can properly access them.
chmod -R 775 dynmap
Add user to apache group and apache user to user group.
usermod -a -G apache user
usermod -a -G user apache
That is it for the Apache HTTP server setup. Yep, just copy the files. Now, onto configuring Dynmap for external HTTP server.
cd /home/user/minecraftserver/plugins/dynmap
Edit the Dynmap configuration.txt file.
First find and comment out this section of the configuration file. Comment everything until you get to the next class statement, which will be the one after this that you uncomment.
- class: org.dynmap.InternalClientUpdateComponent
Now, uncomment out this section of the configuration file.
- class: org.dynmap.JsonFileClientUpdateComponent
Then, change these two configurations
tilespath: web/tiles
webpath: web
to
tilespath: /home/user/public_html/dynmap/tiles
webpath: /home/user/public_html/dynmap
Last change this configuration
disable-webserver: false
to
disable-webserver: true
That is it!
Restart Apache HTTP Server, and start your Minecraft Server. Check the log files to make sure Dynmap starts up properly with no errors. Then load your website at https://minecraft.server.example/dynmap
Attributes:
After searching many means of proxying to the Dynmap built in server, it was only until I found this link that I realized, proxying is the wrong way to go about doing this. Again, I highly recommend to NOT proxy.
https://www.reddit.com/r/admincraft/comments/8j2cbg/setting_up_dynmap_on_a_standalone_webserver_using/