Betterconsolemc config docs start

This commit is contained in:
Jonas_Jones 2024-09-01 18:43:40 +02:00
parent 1f96b8fde1
commit 6cec6c4d1e
9 changed files with 221 additions and 2 deletions

View file

@ -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 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.

View file

@ -0,0 +1,10 @@
{
"position": 4,
"label": "McWebServer",
"collapsible": true,
"collapsed": true,
"link": {
"type": "generated-index",
"description": "Documentation for the McWebServer mod"
}
}

View file

@ -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.

View file

@ -0,0 +1,45 @@
---
sidebar_position: 5
---
# Example Files
## index.html
```html title="index.html"
<html>
<head>
<title>My Server</title>
</head>
<body>
<h1>Welcome to my server</h1>
</body>
</html>
```
## 404.html
```html title="404.html"
<html>
<head>
<title>404 Not Found</title>
</head>
<body>
<h1>404 Not Found</h1>
</body>
</html>
```
## not_supported.html
```html title="not_supported.html"
<html>
<head>
<title>Not Supported</title>
</head>
<body>
<h1>Not Supported</h1>
</body>
</html>
```
## favicon.ico/.png
Add a website icon named `favicon` to the root webserver directory.

View file

@ -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 APIs 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.

View file

@ -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

View file

@ -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 DDOSd 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 servers 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 isnt a scientific test and I wouldnt 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)
:::

View file

@ -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:
<Tabs>
<TabItem value="Linux" label="Linux">
<Tabs>
<TabItem value="apt" label="apt">
```bash
sudo apt install php
```
</TabItem>
<TabItem value="yum" label="yum">
```bash
sudo yum install php
```
</TabItem>
<TabItem value="pacman" label="pacman">
```bash
sudo pacman -S php
```
</TabItem>
<TabItem value="dnf" label="dnf">
```bash
sudo dnf install php
```
</TabItem>
</Tabs>
</TabItem>
<TabItem value="Windows" label="Windows">
Download the PHP installer from the official website and follow the installation instructions.
</TabItem>
</Tabs>
:::info
Make sure the php executable is in your PATH. To check if PHP is installed correctly, run `php -v` in your terminal.
:::

View file

@ -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.