If you want to run multiple game servers on one VPS, the good news is it’s absolutely possible. The bad news is that port conflicts will kill your setup the moment two servers try to grab the same default port.
I’ve been running game servers on rented VPS boxes since 2026, and the same question keeps popping up in forums: “Can I host Minecraft, CS2, and Valheim on the same machine?” The answer is yes, as long as you understand ports, isolate each instance properly, and lock down your firewall rules.
In this guide, I’ll walk you through exactly how I run multiple game servers on one VPS without port conflicts. I’ll cover the two methods that actually work in production (LinuxGSM with user separation and Docker Compose), share my folder layout, and show you the port rules I follow for every new server I deploy.
Table of Contents
Why Port Conflicts Happen (And Why They Are the Main Blocker)
A port conflict happens when two programs try to listen on the same port at the same time. When that occurs, the second server fails to start, crashes silently, or grabs the port and refuses to give it back.
Every game server binds to specific ports. Minecraft uses 25565 by default. Counter-Strike 2 uses 27015. Valheim uses 2456 and 2457. If you run a vanilla Minecraft server and then try to spin up another Minecraft server on the same VPS without changing anything, the second one will either refuse to start or boot into a broken state.
There are two protocol types you need to know about:
TCP (Transmission Control Protocol): Reliable, ordered delivery. Most control traffic uses this.
UDP (User Datagram Protocol): Fast, connectionless. Most actual gameplay traffic uses this.
Many games need both. Minecraft, for example, uses TCP 25565 for some functions. Valheim uses UDP 2456 and UDP 2457 for gameplay. If your firewall only opens TCP, your players will be able to browse the server but never connect.
Once you understand that each server needs its own unique combination of ports, the fix becomes obvious: assign different ports to each instance.
How to Run Multiple Game Servers on One VPS Without Port Conflicts
There are two reliable ways to run multiple game servers on one VPS without port conflicts. Pick one based on your comfort level and how many servers you plan to run.
LinuxGSM with separate Linux users: Each game runs as its own user, in its own folder, with its own ports. Best for 2-10 servers on a mid-range VPS.
Docker Compose with isolated containers: Each game runs in a container with its own network namespace. Best for clean updates, easy rollbacks, and 5+ servers.
Both methods work. The choice depends on whether you prefer bash scripts or YAML configs. I personally run a hybrid setup: LinuxGSM for my long-lived servers and Docker for anything I want to test or spin up quickly.
Method 1: LinuxGSM with User Separation (Traditional Approach)
LinuxGSM is a command-line tool that handles installer scripts, updates, monitoring, and tmux sessions for hundreds of game servers. The official docs recommend running each instance as a separate Linux user for safety and to avoid port collisions caused by shared config files.
Step 1: Prepare Your VPS
Start with a fresh Ubuntu 24.04 or 22.04 LTS VPS. I recommend at least 4 vCPU and 8GB RAM if you plan to run 3+ servers. Update the system and install the dependencies LinuxGSM needs:
sudo apt update && sudo apt upgrade -y
sudo apt install curl wget file tar bzip2 gzip unzip bsdmainutils python3 util-linux ca-certificates binutils bc jq tmux netcat lib32gcc-s1 lib32stdc++6 libsdl2-2.0-0:i386 steamcmd -y
Step 2: Create a Separate User for Each Game Server
This is the most important step for avoiding port conflicts and isolating crashes. When each game runs as its own user, it cannot accidentally read or write another server’s config files.
sudo useradd -m -s /bin/bash mcserver1
sudo passwd mcserver1
sudo useradd -m -s /bin/bash mcserver2
sudo passwd mcserver2
Step 3: Install LinuxGSM for Each Instance
Log in as each user and download the corresponding game script. For two Minecraft servers, for example:
sudo -iu mcserver1
wget -O linuxgsm.sh https://linuxgsm.sh
chmod +x linuxgsm.sh
bash linuxgsm.sh mcserver
./mcserver install
Repeat the same for mcserver2. The install creates a folder structure like /home/mcserver1/serverfiles and /home/mcserver2/serverfiles, which keeps everything separated by user.
Step 4: Assign Different Ports to Each Instance
Here’s where the port conflict actually gets resolved. For the first Minecraft server, edit server.properties inside /home/mcserver1/serverfiles:
server-port=25565
query.port=25565
For the second Minecraft server, edit the same file under /home/mcserver2/serverfiles and change the ports:
server-port=25566
query.port=25566
Now both servers can run at the same time. Player 1 connects to yourdomain.com:25565, player 2 to yourdomain.com:25566. No conflicts.
Step 5: Start and Monitor with tmux
LinuxGSM automatically runs each server inside its own tmux session. To view the live console of server 1:
sudo -iu mcserver1
tmux attach -t mcserver
Detach with Ctrl+B then D. Server 2 lives in a completely separate tmux session under its own user. If one server crashes, it cannot take the other down.
Method 2: Docker Compose for Game Server Isolation
Docker takes user separation to the next level. Each game server runs inside its own container with its own filesystem, its own network namespace, and its own environment variables. Updating one server never touches another. This is the cleanest way to run multiple game servers on one VPS without port conflicts.
Step 1: Install Docker and Docker Compose
On Ubuntu, the official convenience script works fine for a fresh VPS:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
Log out and back in for the group change to apply. Verify with docker --version and docker compose version.
Step 2: Set Up a Folder Layout
I keep every game server under /opt/gameservers/, with one subfolder per game. Each subfolder holds its own docker-compose.yml and a data/ volume for persistent storage.
/opt/gameservers/
├── minecraft/
│ ├── docker-compose.yml
│ └── data/
├── cs2/
│ ├── docker-compose.yml
│ └── data/
└── valheim/
├── docker-compose.yml
└── data/
Step 3: Write Your First docker-compose.yml
For Minecraft, the itzg/minecraft-server image is the most popular. Save this as /opt/gameservers/minecraft/docker-compose.yml:
version: "3.9"
services:
mc:
image: itzg/minecraft-server
container_name: minecraft-1
ports:
- "25565:25565"
environment:
EULA: "TRUE"
TYPE: "PAPER"
MEMORY: "4G"
volumes:
- ./data:/data
restart: unless-stopped
For a second Minecraft server on a different port, copy the folder and change the host port mapping:
ports:
- "25566:25565"
The container’s internal port stays at 25565, but the host (your VPS) now serves it on 25566. This is exactly how you run multiple game servers on one VPS without port conflicts using Docker.
Step 4: Deploy and Update
From inside each folder, run:
docker compose up -d
docker compose logs -f
To update a server, edit the compose file (for example, bump the MEMORY value) and run docker compose up -d again. Only that container restarts. The other servers keep running unaffected.
Step 5: Use Docker Networks for Clean Isolation
If you ever want the containers to talk to each other (for example, a game server connecting to a database) without exposing ports to the public internet, define a custom network in your compose file. This is something you cannot easily do with LinuxGSM without iptables hacks.
networks:
games-net:
driver: bridge
Port Configuration Best Practices for Multiple Game Servers
Good port management is what separates a stable VPS hosting setup from a flaky one. Here is the checklist I follow every time I deploy a new server.
Default Ports for Popular Game Servers
Use this table as your starting point. Always assign a unique port to each instance.
| Game | Default Ports | Protocol |
|---|---|---|
| Minecraft Java | 25565 | TCP |
| Minecraft Bedrock | 19132 | UDP |
| Counter-Strike 2 | 27015, 27036 | UDP + TCP |
| Valheim | 2456, 2457, 2458 | UDP |
| ARK: Survival | 7777, 7778, 27015 | UDP + TCP |
| Team Fortress 2 | 27015, 27005 | UDP |
| Rust | 28015, 28016 | UDP |
| Seven Days to Die | 26900, 26901, 26902 | UDP + TCP |
Port Assignment Rules I Follow
First, write down every port a game uses, not just the main one. CS2 needs three. Valheim needs three. ARK needs three. If you only forward the primary port, your players will see the server but never load the map.
Second, never assign a port that another server on the same VPS is already using. Keep a simple servers.txt file inside /opt/gameservers/ listing every port in use.
Third, when in doubt, shift the whole port range by +10. If Minecraft 1 uses 25565-25567, Minecraft 2 uses 25575-25577. This avoids accidental overlaps with custom plugins or modded server packs.
Fourth, bind containers to specific host IPs if your VPS has multiple. Use the form "192.168.1.10:25565:25565" in docker-compose. This is overkill for most setups but useful on high-density boxes.
UFW Firewall Configuration for Multiple Game Servers
Opening every port on your VPS is the fastest way to get compromised. I use UFW (Uncomplicated Firewall) on every Ubuntu box I deploy. The trick is opening exactly the ports you need, no more.
Step-by-Step UFW Setup
First, allow SSH so you don’t lock yourself out:
sudo ufw allow OpenSSH
Then open the ports for each game server. For our two Minecraft servers and one Valheim server:
sudo ufw allow 25565/tcp
sudo ufw allow 25566/tcp
sudo ufw allow 2456/udp
sudo ufw allow 2457/udp
sudo ufw allow 2458/udp
Enable UFW and verify the rules:
sudo ufw enable
sudo ufw status numbered
Default policy is to deny all incoming traffic and allow all outgoing. That means only the ports you explicitly open are reachable from the internet. To answer the common question “Is it safe to open port 25565?” – yes, as long as you keep your Minecraft server patched and don’t expose any other management ports like 22 to the world. Restrict SSH to your IP with sudo ufw allow from YOUR_IP to any port 22 for an extra layer of safety.
If you prefer running everything through Docker, UFW still works because Docker modifies iptables directly. The simplest fix is to set "iptables": false in /etc/docker/daemon.json and let UFW manage everything. Otherwise Docker will bypass your firewall rules.
Common Mistakes When Running Multiple Game Servers (And How to Avoid Them)
After helping forum members debug their setups for years, these are the mistakes that come up over and over again.
Forgetting to change default ports. This is the number one reason two servers collide. Every game has a default port, and if you copy a config file from one instance to another without editing the port, the second server will refuse to start. Always review the port fields in server.properties, game.ini, or whatever config file your game uses before starting.
Mixing TCP and UDP. Opening only TCP for Valheim means players can see the server in their browser but the connection handshake fails. Open both protocols for every port your game uses.
Running all servers as root. If one server gets compromised through a mod or plugin, the attacker owns your entire VPS. Always run game servers as separate unprivileged users, or inside Docker containers.
Not allocating enough RAM. Minecraft alone can swallow 6GB easily. CS2 wants at least 6GB too. If you cram three game servers into a 4GB VPS, the kernel will start killing processes. Match your VPS tier to the games you actually want to host.
Skipping backups. When you run multiple servers, manual backups become impossible fast. Set up a cron job or use a Docker backup container that snapshots the data/ folder every night. Losing 200 hours of ARK progress hurts more than losing 200 hours of anything else.
Letting Docker bypass UFW. By default Docker adds iptables rules that ignore UFW. If you don’t fix this, your firewall rules are cosmetic and every port you published in docker-compose.yml is exposed to the world whether you opened it in UFW or not.
FAQs
Can you run multiple game servers at once?
Yes, you can run multiple game servers at once on a single VPS. The key is assigning each server a unique set of TCP and UDP ports so they don’t collide. Most hosting providers give you enough resources to run 3-5 mid-sized game servers on one machine as long as you isolate them using separate Linux users or Docker containers.
How to host a game server without port forwarding?
You can host a game server without traditional port forwarding by using a tunneling service like Tailscale, ZeroTier, or Playit.gg. These tools create an outbound connection to a relay server and give you a public hostname, so you never have to open ports on your home router. On a VPS this is rarely needed because ports are already exposed by default.
Is it safe to open port 25565?
Opening port 25565 (the Minecraft Java default) is safe as long as your server is patched and you use a non-root user. To reduce risk, restrict SSH access to your IP only, keep UFW enabled with a default deny policy, and never expose management ports like 22 or 3306 to the public internet.
How to have multiple servers with one IP?
To have multiple game servers on one IP, assign a unique port to each server and have players connect using the IP plus that port (for example, yourserver.com:25565 and yourserver.com:25566). Your VPS then routes the traffic to the correct game server based on the port number. This works for every game that lets you customize the listening port in its config file.
Conclusion
Running multiple game servers on one VPS without port conflicts is a solved problem once you understand the two rules: every server needs its own ports, and every server needs its own isolated process space. Pick LinuxGSM with user separation if you want a battle-tested bash workflow, or pick Docker Compose if you want clean updates and repeatable configs.
I’ve hosted as many as six game servers on a single 8-core VPS using a mix of both methods, and the only times I had outages were when I forgot to change a default port. Set up UFW, pick unique ports, isolate each instance, and your VPS will happily run Minecraft, CS2, Valheim, and more side by side. Pick a method from this guide, deploy your first server today, and add more as your community grows.
1 thought on “How to Run Multiple Game Servers on One VPS (September 2026)”