Theo's Corner
dev / irl / thoughts
← Back
tech

Understanding ports — what they are and why they matter

Theo|Jul 2026|~4 min read

Ports come up constantly in server work — open this port, block that port, the app is running on port 3000, forward port 25565 for Minecraft. Here's what they actually are.

The concept

An IP address gets you to a machine. A port gets you to a specific service on that machine. Think of the IP as the building address and the port as the flat number. Multiple services can run on the same machine simultaneously because they each listen on different ports. Your web server listens on 80 and 443. Your database listens on 5432. Your app listens on 3000. Same machine, different doors.

Well-known ports

Ports below 1024 are reserved for well-known services. The important ones to know:

Above 1024 are available for anything. Pterodactyl game servers typically use ports in the 25000-35000 range. Your Node app probably runs on 3000 or 8080. It's mostly convention above 1024.

When you see something like localhost:3000 — localhost is the machine itself, 3000 is the port. The app is running on your machine, listening on port 3000 for connections.

Why firewalls care about ports

A firewall controls which ports are reachable from outside. If you run a database on port 5432 and your firewall allows incoming connections on 5432, your database is accessible from the internet — which is almost certainly not what you want. Good firewall config means only the ports that genuinely need to be public (80, 443, maybe 22) are open. Everything else is closed.

Reverse proxying and ports

One of the things nginx does as a reverse proxy is handle port translation. Your app runs on port 3000, which you don't want exposed. nginx listens on 443, accepts HTTPS traffic, and forwards it to port 3000 internally. The user hits port 443. The app sees port 3000. nginx bridges them. This is why you can run multiple apps on the same machine — each on a different internal port — all accessible via standard HTTPS on port 443.

Pterodactyl specifically

For game hosting, each server process needs its own port — players connect directly to the game server, not through a proxy. Pterodactyl allocates ports from a defined range to each server. Managing those allocations, making sure ports don't conflict, knowing which ports need to be open in the firewall — this is a significant part of what running a game hosting company actually involves day to day.