Liberty Web Docs

Welcome to the LibertyBans Web Interface Documentation.

Installation Guide

server:
  # On what port the server will run
  port: 8080
  host: "0.0.0.0"

# Cache configuration
caffeine:
  # Some usernames aren't saved in the database, so we must retrieve them using Mojang's API
  # The provided configuration should be suitable for most users
  mojang:
    # Maximum amount of usernames to cache
    maxSize: 150
    # After what time cache record will expire
    expiration: "10m"

NOTE: It is highly recommended to create a new user with read-only access to your punishments database.

Reverse Proxy

After you setup Libertybans Web, you will probably want it to be available to https, on a domain. A reverse proxy allows you to run infinite web servers on the same port by proxying the requests.

The following are the requirements for doing so:

  1. A VPS/Dedicated Server.
  2. Basic knowledge with linux.
  3. A (sub)domain.
  4. You are not able to do that on any hosting with a simple panel like pterodactyl.
  5. Run LibertyWeb on a port that is not 443 or 80, as they will be used by the reverse proxy.
  6. Running LibertyWeb on the same machine (very recommended, but not required).

Installing NGINX

Note: You do not need to install it if you are running pterodactyl for example.

The following is how to install Nginx on Debian-Based linux distributions.

sudo apt update
sudo apt-get install nginx
sudo systemctl enable --now nginx
sudo systemctl start nginx

Run the following to check if Nginx was installed & running properly:

curl 127.0.0.1:80

If it prints an HTML, then it's working properly.

Installing certbot

The following is how to install certbot on Debian-Based linux distributions.

sudo apt update
sudo apt install -y certbot
sudo apt install -y python3-certbot-nginx

Creating a Certificate

For HTTPS to be secure, a certificate is required. You need to do the following before proceeding.

  1. Set the domain you want to use to A record, and set the IP to your VPS/Dedicated Server IP. If you're using CloudFlare, disable proxy mode (the cloud icon) unless you know what you're doing.
  2. Make sure the port 443 and 80 are allowed through your firewall (443 is required for the web server to stay working.)

Run the following command to create the certificate:

certbot certonly --nginx -d <DOMAIN>

Creating the NGINX configuration file.

SFTP into your machine. Go to this directory /etc/nginx/sites-available and create a new file and call it libertyweb.conf

Open the file and set the file content to this, replace with your domain, and with the port running LibertyWeb.

server {
    listen 443 ssl;
    server_name <DOMAIN>;

    ssl_certificate /etc/letsencrypt/live/<DOMAIN>/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/<DOMAIN>/privkey.pem;

    location / {
        proxy_pass http://<HOST>:<PORT>;
        proxy_set_header Host $host;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

Enabling Configuration

The final step is to enable your NGINX configuration and restart it.

sudo ln -s /etc/nginx/sites-available/libertyweb.conf /etc/nginx/sites-enabled/libertyweb.conf
sudo systemctl restart nginx

Done!

It should be accessible from your domain now, with https!