Skip to content

Configuring your FiveM server

Updated July 02, 2026
FiveM
FiveM Configuration | GameServerKings KB

FiveM Configuration

This guide covers server.cfg (the main FiveM configuration file) and the Windows Firewall rules your server needs. Complete 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
# 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

FieldNotes
sv_hostnameYour server name as shown in the FiveM server list
sv_projectName / sv_projectDescShort name and description shown in the server browser
sv_maxClientsSlot count. For more than 32, see OneSync
sv_licenseKeyThe key from Setup Step 1 (starts with cfxk_)
rcon_passwordA long random password for remote console access
add_principalYour own identifiers, so you can use admin commands
sets tagsComma-separated tags for the server browser filters
sets localeServer 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.

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 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

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.
Made with 💜 by GameServerKings