📂 File Browser

serversdashboard
🌙 Dark Mode
🎯 Quick Launch:

📁 Directories

📁 api/ 🔓 Open
📁 assets/ 🔓 Open
📁 data/ 🔓 Open
📁 lib/ 🔓 Open
📁 serversdashboard/ 🔓 Open

📄 Files

📄 README.md
▶ Open 📄 View Source
🐘 _debug.php
▶ Open 📄 View Source
🐘 auth.php
▶ Open 📄 View Source
🐘 config.php
▶ Open 📄 View Source
🐘 index.php
▶ Open 📄 View Source

📄 Source: README.md

# Minecraft Server Dashboard

A self-hosted dashboard for managing multiple Minecraft servers living under
`/mnt/1tb_ssd/*/`. Built for a single-user (or small trusted group) homelab
setup running on a PHP built-in server.

## What it does (v1)

- **Auto-discovers** every server folder under `/mnt/1tb_ssd/`
- **Start / Stop / Restart** each server via `systemctl` (if a unit exists)
or via a `start.sh` / `stop.sh` fallback
- **Enable / Disable** auto-start on boot
- **Live console** output (from tmux session named after the server folder,
or from `logs/latest.log`)
- **Send commands** to the running server console
- **Player list** (online players via RCON or `list` command)
- **Login gate** with:

- LAN bypass (home network = no login)
- Password login otherwise
- Optional per-account device binding
- Accounts manageable from the home network or from the owner account

## What it does NOT do yet (v2)

- Inventory viewer (needs RCON + NBT parsing — scaffold is present, parsing TBD)
- ClientID mod/resourcepack viewer (needs `/clientid viewmods` output parsing)

## Directory layout

```
serversdashboard/
├── index.php                 # Main UI
├── config.php                # Central config (edit this)
├── auth.php                  # Login gate + session logic
├── lib/
│   ├── servers.php           # Server discovery + systemctl wrappers
│   ├── rcon.php              # Minimal Source RCON client (PHP)
│   ├── tmux.php              # tmux capture-pane wrapper
│   ├── net.php               # LAN detection
│   └── users.php             # Account store (JSON file)
├── api/
│   ├── status.php
│   ├── start.php
│   ├── stop.php
│   ├── restart.php
│   ├── enable.php
│   ├── disable.php
│   ├── console.php
│   ├── command.php
│   ├── players.php
│   ├── login.php
│   ├── logout.php
│   └── users.php
├── assets/
│   ├── style.css
│   └── dashboard.js
├── data/
│   └── users.json            # Created on first run (chmod 600)
└── install/
    ├── sudoers.example
    └── setup.sh
```

## Setup (5 minutes)

### 1. Drop the folder in place

```
mv serversdashboard /home/ezyalex700/mywebsite/
cd /home/ezyalex700/mywebsite/serversdashboard
```

### 2. Create the data dir

```
mkdir -p data
chmod 700 data
```

### 3. Edit `config.php`

Set your server root (default `/mnt/1tb_ssd`), your LAN subnet, and the
owner username/password.

### 4. (Optional) sudoers rule for systemctl

If your servers run as systemd units, PHP needs passwordless sudo for the
specific commands. See `install/sudoers.example`.

If your servers just run in tmux (like yours currently do), you can skip
sudo entirely — the dashboard will use the `start.sh` / `stop.sh` fallback.

### 5. Run the PHP built-in server

```
cd /home/ezyalex700/mywebsite/serversdashboard
php -S 0.0.0.0:8080
```

Then visit `http://<server-ip>:8080`.

For a permanent setup, run it under systemd or behind a reverse proxy.

## Security notes

- `data/users.json` stores password hashes (bcrypt), never plaintext.
- LAN bypass is determined by the client IP matching `LAN_SUBNETS`.
- Device binding stores a random token in a cookie; if the cookie is missing
or wrong, the account is refused even with a correct password.
- The dashboard can `systemctl stop` your server. Do not expose it to the
public internet without HTTPS and a reverse proxy.

## Adding a new server

Just drop a folder in `/mnt/1tb_ssd/`. The dashboard picks it up on next
load. For auto-start, either:

- create a systemd unit named `mc-<foldername>.service`, or
- put a `start.sh` in the folder (the dashboard calls it).
← Back