From 6cec6c4d1ec55e24c391ff77e9597bcd4e333997 Mon Sep 17 00:00:00 2001 From: Jonas_Jones Date: Sun, 1 Sep 2024 18:43:40 +0200 Subject: [PATCH] Betterconsolemc config docs start --- docs/betterconsolemc/intro.mdx | 4 +- docs/mcwebserver/_category_.json | 10 +++++ docs/mcwebserver/configuration.mdx | 22 +++++++++++ docs/mcwebserver/examplefiles.mdx | 45 ++++++++++++++++++++++ docs/mcwebserver/intro.mdx | 24 ++++++++++++ docs/mcwebserver/loggers.mdx | 24 ++++++++++++ docs/mcwebserver/performance.mdx | 21 ++++++++++ docs/mcwebserver/phpsupport.mdx | 61 ++++++++++++++++++++++++++++++ docs/mcwebserver/setup.mdx | 12 ++++++ 9 files changed, 221 insertions(+), 2 deletions(-) create mode 100644 docs/mcwebserver/_category_.json create mode 100644 docs/mcwebserver/configuration.mdx create mode 100644 docs/mcwebserver/examplefiles.mdx create mode 100644 docs/mcwebserver/intro.mdx create mode 100644 docs/mcwebserver/loggers.mdx create mode 100644 docs/mcwebserver/performance.mdx create mode 100644 docs/mcwebserver/phpsupport.mdx create mode 100644 docs/mcwebserver/setup.mdx diff --git a/docs/betterconsolemc/intro.mdx b/docs/betterconsolemc/intro.mdx index 7da8c7c..ece2d27 100644 --- a/docs/betterconsolemc/intro.mdx +++ b/docs/betterconsolemc/intro.mdx @@ -9,6 +9,6 @@ BetterConsoleMC is availabe on [Modrinth](https://modrinth.com/mod/betterconsole This mod allows for simple ingame command creation to allow for system command execution trough a player on the server. -This mod can be looked at as version 2.0 of [ConsoleMC](https://github.com/JonasunderscoreJones/ConsoleMC) which while being powerful enough, has a big security flaw whe used on big and/or public servers in a way that everyone (that is OP) can run any command on the MC server's host system, giving anyone access to the entire machine and allowing for bad actions to be taken by people who shouldn't have access to it. +This mod can be looked at as version 2.0 of [ConsoleMC](https://github.com/JonasunderscoreJones/ConsoleMC) which while being powerful enough, has a big security flaw when used on big and/or public servers in a way that everyone (that is OP) can run any command on the MC server's host system, giving anyone access to the entire machine and allowing for bad actions to be taken by people who shouldn't have access to it. -Visit the [Configuration](/betterconsolemc/configuration) page to learn how to configure the mod to your liking. +Visit the [Configuration](/betterconsolemc/configuration) page to learn how to configure the mod to your liking and how to keep your server secure. diff --git a/docs/mcwebserver/_category_.json b/docs/mcwebserver/_category_.json new file mode 100644 index 0000000..c1429b4 --- /dev/null +++ b/docs/mcwebserver/_category_.json @@ -0,0 +1,10 @@ +{ + "position": 4, + "label": "McWebServer", + "collapsible": true, + "collapsed": true, + "link": { + "type": "generated-index", + "description": "Documentation for the McWebServer mod" + } + } \ No newline at end of file diff --git a/docs/mcwebserver/configuration.mdx b/docs/mcwebserver/configuration.mdx new file mode 100644 index 0000000..dfb6bec --- /dev/null +++ b/docs/mcwebserver/configuration.mdx @@ -0,0 +1,22 @@ +--- +sidebar_position: 3 +--- + +# Config File +The default comfing file + +```properties title="config/mcwebserver.properties" +web.isEnabled=false #whether or not the webserver should be enabled or not | default: false +web.port=8080 #The port of the webserver | default: 8080 +web.root=webserver/ #the root directory of the webserver, starting from the main server directory | default: webserver/ +web.file.root=index.html #the name of the html file for the homepage | default: index.html +web.file.404=404.html #the name of the html file for 404 page | default: 404.html +web.require_token=false #wether or not you are required to provide a token to access files on the webserver | default: false +web.api=true #whether or not the webserver api should be enabled or not | default: true +web.api.adv=true #whether or not the api should expose information such as player coordinates and inventory | default: true +web.file.notSupported=not_supported.html #the name of the html file for 'not supported' page | default: not_supported.html +logger.verbose=true #whether or not to log verbose output | default: true +web.php=false # enable php | default: false +``` + +For more infos about PHP support, visit the [PHP Support](phpsupport) page. diff --git a/docs/mcwebserver/examplefiles.mdx b/docs/mcwebserver/examplefiles.mdx new file mode 100644 index 0000000..4d27a1c --- /dev/null +++ b/docs/mcwebserver/examplefiles.mdx @@ -0,0 +1,45 @@ +--- +sidebar_position: 5 +--- + +# Example Files + +## index.html +```html title="index.html" + + + My Server + + +

Welcome to my server

+ + +``` + +## 404.html +```html title="404.html" + + + 404 Not Found + + +

404 Not Found

+ + +``` + +## not_supported.html +```html title="not_supported.html" + + + Not Supported + + +

Not Supported

+ + +``` + +## favicon.ico/.png + +Add a website icon named `favicon` to the root webserver directory. \ No newline at end of file diff --git a/docs/mcwebserver/intro.mdx b/docs/mcwebserver/intro.mdx new file mode 100644 index 0000000..df55ec2 --- /dev/null +++ b/docs/mcwebserver/intro.mdx @@ -0,0 +1,24 @@ +--- +slug: /mcwebserver +sidebar_position: 1 +--- + +# Introduction + +This mod runs a simple HTTP server alongside the minecraft server. The mod allows You to host websites and share files and Server Backups directly from your server without the need of a seperate server setup. Adjust the port and design your website. + +It also has a powerful API allowing you to fetch server info about players and the server itself. More info on the API’s Wiki page + +The http server has up to no performance impact on the server. For more information on the performance impact visit the [Performance](/mcwebserver/performance) page. + + +:::warning WARNING: Use at your own risk! + +If used wrongly this mod can be a security risk for your server and all devices connected to the network that your server is in. + +Do only put files into your webservers root directory that you want to be accessible to the internet. Those files are public to the entire world. + +::: + + +Visit the [Configuration](/mcwebserver/configuration) page to learn how to configure the mod to your liking and how to keep your server secure. \ No newline at end of file diff --git a/docs/mcwebserver/loggers.mdx b/docs/mcwebserver/loggers.mdx new file mode 100644 index 0000000..9d6a329 --- /dev/null +++ b/docs/mcwebserver/loggers.mdx @@ -0,0 +1,24 @@ +--- +sidebar_position: 6 +--- + +# Loggers +McWebserver has two different loggers: Default and Verbose. + +## Default Logger + +This loggers is always enabled and logs the most important stuff such as: + +- Mod initialized +- Webserver enabled/disabled +- API enabled/disabled +- Webserver starting/stopping +- Webserver started/stopped +- Internal server errors while handling requests (this means only error code `500`) + +## Verbose Logger + +This logger is disabled by default. It logs: + +- Every request made to the webserver + diff --git a/docs/mcwebserver/performance.mdx b/docs/mcwebserver/performance.mdx new file mode 100644 index 0000000..76f780e --- /dev/null +++ b/docs/mcwebserver/performance.mdx @@ -0,0 +1,21 @@ +--- +sidebar_position: 8 +--- + +# Performance Impact + +McWebserver attempts to be as lightweight as possible. + +An experiment shows that this is clearly the case. Even when the server is getting DDOS’d and the website might not be available due to the high demand of the DDOS, the server still runs perfectly fine. + +The following gif shows a DDOS script using 300 threads (300 simultaneous requests at the same time) and the server’s MSPT (Milliseconds per Tick) only rises by about 2ms while under the DDOS attack. + +![DDOS Test](https://cdn.jonasjones.dev/misc/mcwebserver-ddos-performance-impact.gif) + +:::note + +This isn’t a scientific test and I wouldn’t claim that the server can withstand a real DDOS attack. The results only give an idea of the performance impact under elevated load and demand. + +The script used for the test can be found [here](https://github.com/JonasunderscoreJones/turbo-octo-potato/blob/main/localhost-ddos.py) + +::: \ No newline at end of file diff --git a/docs/mcwebserver/phpsupport.mdx b/docs/mcwebserver/phpsupport.mdx new file mode 100644 index 0000000..c615848 --- /dev/null +++ b/docs/mcwebserver/phpsupport.mdx @@ -0,0 +1,61 @@ +--- +sidebar_position: 7 +--- + +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# PHP Support + +:::note + +Additional software is required to run PHP scripts on your server. This is not included in the default installation. + +::: + +McWebserver supports PHP. This means you can run PHP scripts on your server. + +To enable PHP support, set `web.php` to `true` in the `mcwebserver.properties` file. + +```properties title="config/mcwebserver.properties" +web.php=true # enable php | default: false +``` + +After enabling PHP support, you can create PHP files in the `webserver` directory. These files will be executed by the PHP interpreter. + +To install the php interpreter, you can use the following command: + + + + +```bash +sudo apt install php +``` + + +```bash +sudo yum install php +``` + + +```bash +sudo pacman -S php +``` + + +```bash +sudo dnf install php +``` + + + + + Download the PHP installer from the official website and follow the installation instructions. + + + +:::info + +Make sure the php executable is in your PATH. To check if PHP is installed correctly, run `php -v` in your terminal. + +::: diff --git a/docs/mcwebserver/setup.mdx b/docs/mcwebserver/setup.mdx new file mode 100644 index 0000000..4de21db --- /dev/null +++ b/docs/mcwebserver/setup.mdx @@ -0,0 +1,12 @@ +--- +sidebar_position: 2 +--- + +# Setup + +1. Download the latest version of McWebserver from [modrinth](https://modrinth.com/mod/mcwebserver) or [curseforge](https://www.curseforge.com/minecraft/mc-mods/mcwebserver) as well as the Fabric API into your mods folder +2. Start the Minecraft Server and let the mod create the config file +3. Stop the server and open the Config File, enable the webserver and configure the mod further. View the [Config File](configuration) page for more information. +4. Use the [Example Files](examplefiles) or create your own +5. Port forward the webserver port if you plan on using it publicly +6. (Optional) Take a look at how to configure the loggers to prevent unnecessary spam. View the [Loggers](loggers) page for more information. \ No newline at end of file