---
title: "Configuring your FiveM server"
description: "Set up a working server.cfg for FiveM on Windows, configure license keys, set ports, define admin principals, and fix boot errors."
url: "https://www.gameserverkings.com/knowledge-base/fivem/configuration-overview/"
category: "FiveM"
category_url: "https://www.gameserverkings.com/knowledge-base/fivem/"
published: "2026-07-02T01:35:57.837Z"
updated: "2026-07-31T23:04:36.444Z"
source_format: "markdown"
site: "GameServerKings"
---

# Configuring your FiveM server

This guide covers `server.cfg` (the main FiveM configuration file) and the Windows Firewall rules your server needs. Complete [Setup](/knowledge-base/fivem/setup/) first.

## Configure server.cfg

Open `C:\FXServer-data\server.cfg` in a text editor (VS Code, Notepad++, or even Notepad).

The default file from the cloned template is sparse. Replace it with this baseline:

```cfg title="server.cfg"
# Listening endpoints
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"

# Resources to start on boot
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure basic-gamemode
ensure hardcap
ensure rconlog

# Server info
sv_hostname "My GSK FiveM Server"
sv_projectName "My Server"
sv_projectDesc "A fresh GSK-hosted FiveM server"
sv_maxClients 32

# License key from keymaster.fivem.net
sv_licenseKey "PASTE_YOUR_LICENSE_KEY_HERE"

# Steam Web API key (optional, for Steam identifiers)
# Generate at https://steamcommunity.com/dev/apikey
set steam_webApiKey "PASTE_OR_LEAVE_BLANK"

# Admin: replace with your own identifier(s)
add_principal identifier.fivem:YOUR_FIVEM_ID group.admin
add_principal identifier.steam:YOUR_STEAM_HEX group.admin

# RCON password
rcon_password "STRONG_RANDOM_PASSWORD"

# Server tags shown in the FiveM server list
sets tags "default, gsk, dev"

# OneSync (required for >32 players)
set onesync on

# Locale: enUS, frFR, deDE, esES, etc.
sets locale "en-US"
```

### Fields to Update

| Field | Notes |
|-------|-------|
| sv_hostname | Your server name as shown in the FiveM server list |
| sv_projectName / sv_projectDesc | Short name and description shown in the server browser |
| sv_maxClients | Slot count. For more than 32, see [OneSync](/knowledge-base/fivem/onesync-updates-backups/) |
| sv_licenseKey | The key from Setup Step 1 (starts with `cfxk_`) |
| rcon_password | A long random password for remote console access |
| add_principal | Your own identifiers, so you can use admin commands |
| sets tags | Comma-separated tags for the server browser filters |
| sets locale | Server language locale |

### Finding Your Own Identifiers for Admin Access

The `add_principal` lines grant admin rights to specific players. To find your identifiers:

1. Start the server and connect to it.

2. In the server console (or txAdmin live console), your identifiers are logged when you join.

3. They look like `fivem:1234567`, `steam:110000112345678`, `license:abc123...`, `discord:123456789012345678`.

4. Use any one of them in an `add_principal identifier.TYPE:VALUE group.admin` line.

> [!IMPORTANT] Admin changes need a restart
> Restart the server after editing identifiers.

### The ensure Directive

Each `ensure resourcename` line tells FXServer to start that resource on boot. The order matters when one resource depends on another (frameworks especially). When you install new resources, add an `ensure` line for each. See [Database and Frameworks](/knowledge-base/fivem/database-and-frameworks/) for examples.

## Open Firewall Ports

FiveM uses TCP and UDP port 30120 by default. Open both in Windows Firewall.

In PowerShell (as Administrator):

```powershell
New-NetFirewallRule -DisplayName "FiveM TCP 30120" -Direction Inbound -Protocol TCP -LocalPort 30120 -Action Allow
New-NetFirewallRule -DisplayName "FiveM UDP 30120" -Direction Inbound -Protocol UDP -LocalPort 30120 -Action Allow
```

> [!NOTE] Each server on the machine needs its own port
> If you are running multiple FiveM servers on the same machine, give each its own port (30121, 30122, etc.) in both the `endpoint_add_tcp` / `endpoint_add_udp` lines and the firewall rules.

### Verify the Ports Are Open

After adding the rules and starting your server, test from another machine:

```powershell
Test-NetConnection -ComputerName YOUR_SERVER_IP -Port 30120
```

A `TcpTestSucceeded : True` confirms the TCP side. UDP is harder to test directly, but if players can connect, both are working.

## Common Configuration Issues

- **License key error on boot**: The key is tied to the IP you generated it for. If your server IP changed, regenerate the key on keymaster.
- **Server boots but does not appear in the server list**: Confirm `sv_licenseKey` is set and valid, and that the server can reach the internet to register with CFX.re.
- **Cannot use admin commands**: Your identifier in `add_principal` is wrong or you are using a different account than expected. Check the join logs for your actual identifiers.
- **"Could not connect to server"**: Firewall ports are likely closed. Re-run the firewall rule commands and verify with `Test-NetConnection`.

## What to Read Next

- [Running as a Service](/knowledge-base/fivem/running-as-service/) so the server survives reboots and closed windows
- [Database and Frameworks](/knowledge-base/fivem/database-and-frameworks/) for ESX, QBCore, and resources
- [OneSync, Updates, and Backups](/knowledge-base/fivem/onesync-updates-backups/) for scaling and maintenance

---

Made with 💜 by GameServerKings
