server.cfg explained: every FiveM server.cfg line, one by one

What each line in a FiveM server.cfg does: endpoints, sv_hostname, projectName, tags, locale, icon, sv_maxclients, license key, OneSync, ensure, ACE and exec.

You opened server.cfg and it is a wall of lines you copied from a recipe. This guide goes through the lines you will find in most servers, in the order they usually appear, with a short explanation and a link where there is a longer guide.

Endpoints

cfg
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"

These are the address and port where the server listens. 0.0.0.0 means every network interface, and 30120 is the default port. Players connect over UDP and use TCP for HTTP and the txAdmin proxy, so you open both in your firewall. With txAdmin, the interface and port are usually managed for you, and the txAdmin settings can complain if they do not match. If players cannot join from outside, see port forwarding.

Name and listing

cfg
sv_hostname "My Server"
sets sv_projectName "My Server"
sets sv_projectDesc "A friendly roleplay server"
sets tags "roleplay, esx, english"
sets locale "en-US"
load_server_icon myLogo.png
  • sv_hostname is the older server name.
  • sv_projectName and sv_projectDesc are the name and description in the server list. The sets form publishes them.
  • tags are the keywords people filter by, and locale is the language.
  • load_server_icon loads a small PNG from the server folder.

Colours, banners and the icon size are covered in server icon, banner and tags.

Players

cfg
sv_maxclients 48

The number of player slots. Going above 48 needs OneSync and a supporter tier on the Cfx.re side. The details are in OneSync and the player limit.

Keys

cfg
sv_licenseKey "cfxk_xxxxxxxxxxxxxxxxxxxx_xxxxx"
set steam_webApiKey "none"

sv_licenseKey is the key from the Cfx.re Portal, and the server will not start without a valid one. See server license key error. steam_webApiKey is only needed if you want Steam identifiers, and none is accepted when you do not. Both lines are secrets: do not share your server.cfg in screenshots.

Database

cfg
set mysql_connection_string "mysql://user:password@localhost/dbname?charset=utf8mb4"

The connection string oxmysql reads. Wrong values give the errors in oxmysql connection error. Use set, not setr or sets, so the password stays on the server.

OneSync and game build

cfg
set onesync on
sv_enforceGameBuild 3258

onesync on turns on OneSync, which is the standard for modern servers and needed for many slots. sv_enforceGameBuild forces clients to use a game build, and DLC cars, clothes and maps need a recent one. The build numbers and what they unlock are in sv_enforceGameBuild and DLC. Use a build number supported by your artifacts, not just the one in this example.

Resources: ensure

cfg
ensure oxmysql
ensure ox_lib
ensure es_extended
ensure [standalone]

Each ensure starts a resource, or a whole bracket folder. Order matters: databases, libraries and the framework first. See server.cfg ensure order. If one fails, couldn't start resource explains the message.

Permissions: add_ace and add_principal

cfg
add_ace group.admin command allow
add_principal identifier.fivem:1234567 group.admin

add_ace gives a permission to a group, here every command. add_principal puts a player (by identifier) in that group. Replace the identifier with your own. The full explanation, with the difference between ACE and your framework's own groups, is in ACE permissions.

Including other files: exec

cfg
exec permissions.cfg
exec resources.cfg

exec runs another cfg file as if its lines were here. Splitting permissions or resources into their own files keeps server.cfg readable, and you can keep the secrets in one file you never share.

A minimal example

cfg
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"

sv_licenseKey "cfxk_..."
sv_hostname "My Server"
sets sv_projectName "My Server"
sets sv_projectDesc "A friendly roleplay server"
sets tags "roleplay"
sets locale "en-US"
load_server_icon myLogo.png
sv_maxclients 48
set onesync on
set mysql_connection_string "mysql://user:password@localhost/dbname?charset=utf8mb4"

ensure oxmysql
ensure ox_lib
ensure es_extended

Warning: a typo in a line does not always stop the server. A misspelled convar is created silently and does nothing. When a setting seems ignored, check the spelling first.

Checklist

Symptom Fix
Players cannot join from outside Open TCP and UDP on the port, see port forwarding
Server will not start Check sv_licenseKey
Name or tags not showing Use sets, restart, and wait for the listing to refresh
Over 48 slots refused Enable OneSync and check your Cfx.re tier
Database errors Check mysql_connection_string
DLC content missing Raise sv_enforceGameBuild
Not admin Fix add_principal with your own identifier

Quick answers

Where is server.cfg?

In your server data folder, next to the resources folder. With txAdmin you can also open and edit it from the CFG Editor page in the web panel.

Do I need to restart after editing server.cfg?

Yes. The file is read when the server starts. Restart the server for changes to endpoints, convars and permissions. New ensure lines can also be run in the live console.

What is the difference between set, sets and setr?

set creates a convar only the server can read. sets also publishes it in the server listing. setr replicates it to clients as well, so never put a secret in setr or sets.

Scripts that skip this problem

Shop CreatorBuild a shop in under a minute — owners, employees, vaults and robberies included.View script →Mic PhoneA foldable phone that unfolds into a tablet and carries onto a player's real phone.View script →

Keep reading