Skip to content

Instantly share code, notes, and snippets.

@shikendon
Last active March 21, 2024 06:39
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save shikendon/f2ce4b96c89fa3f5d6af1d6f67e4e00a to your computer and use it in GitHub Desktop.
Save shikendon/f2ce4b96c89fa3f5d6af1d6f67e4e00a to your computer and use it in GitHub Desktop.
Deploy a simple Minecraft proxy server.
# Change your BungeeCord configuration to enable PROXY Protocol.
listeners:
- host: 0.0.0.0:25577
proxy_protocol: true

Flow diagram

+------------+                      +-----------+                      +---------------------+
|            +---------------------->           +---------------------->                     |
|  Player A  |    TCP connection    |  OVH VPS  |    PROXY Protocol    |  BungeeCord Server  |
|            <----------------------+           <----------------------+                     |
+------------+                      +-----------+                      +---------------------+

Requirement

  • Linux Kernel 4.9+ (Debian 11 is recommended)

Install sudo if you haven't yet

sudo -V || apt -y install sudo

Update the Package Index

sudo apt -y update

Install curl if you haven't yet

sudo apt -y install curl

Setup IP address environment variables

# This proxy server IP address (Auto fetch)
export INSTANCE_IPV4=$(curl -4fsSL ip.denpa.io)

# The port you want to expose to your players, usually same as your Minecraft server
export EXPOSED_PORT=25565

# Your Minecraft server IP address
export BACKEND_HOST=1.2.3.4:25577

Allow Minecraft port on firewall

sudo ufw allow ${EXPOSED_PORT} 2>/dev/null || echo "ufw not found, ignore it."

Enable Google BBR

curl -fsSL git.io/deploy-google-bbr.sh | bash

Install HAProxy

curl -fsSL git.io/deploy-haproxy.sh | sudo -E bash

Done

echo "You can now use '${INSTANCE_IPV4}:${EXPOSED_PORT}' to connect to your Minecraft server."
@Shivam9864op
Copy link

For UDP?? for tcp its worked😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment