FiveM server.cfg and license key: the settings that matter
A FiveM server starts from one file, server.cfg, which tells it what port to use, what to call itself, which resources to load and how to prove it is a legitimate server. Get that file right and almost everything else follows. This guide explains the license key, the core settings and the habits that keep the file readable as it grows.
What FiveM needs to run
FiveM is a modification that adds multiplayer to Grand Theft Auto V. A FiveM server needs:
- The server files, installed by your panel or downloaded from the official FiveM site.
- A license key, which is free, from the Cfx.re portal.
- A
server.cfgthat points to your resources and sets your options.
If you use txAdmin, the management panel that ships with the server, it can generate a starting server.cfg through its setup wizard. Set up your GTA V (FiveM) server with txAdmin explains that process.
Getting a license key
- Sign in to the Cfx.re portal with your Cfx.re account.
- Open the section for server keys and create a new key.
- Give it a name and the IP address of your server, if it asks for one.
- Copy the key. It begins with
cfxk_.
Each server needs its own key. Keep it private, because anyone who has it can run a server under your name. If it leaks, revoke it in the portal and create a new one.
The core of server.cfg
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
sv_licenseKey "cfxk_your_key_here"
sv_hostname "My Roleplay Server"
sets sv_projectName "My Roleplay Server"
sets sv_projectDesc "A friendly community. Join our Discord."
sv_maxclients 48
sets tags "roleplay, english, friendly"
sets locale "en-US"
set onesync on
What these lines do:
endpoint_add_tcpandendpoint_add_udpset the address and port the server listens on. 30120 is the default. Both TCP and UDP need to be reachable, and on a managed host you use the port your panel gives you. See How game server ports work.sv_licenseKeyis your key from the portal.sv_hostnameis the name shown in the server list.setslines set information that appears in the server browser. Tags and the locale help players find you.sv_maxclientsis the player limit. The allowed maximum depends on your Cfx.re subscription tier, so check what yours allows.onesync onturns on the system that lets servers handle many more players and synchronises entities. Most servers want it.
Keep text values in straight double quotes.
Starting resources
Resources are the scripts and assets that make your server work. You start them with ensure:
ensure mapmanager
ensure spawnmanager
ensure chat
ensure my-first-resource
Order matters. A resource that depends on another must come after it. The usual pattern is to start base resources first, then the database layer, then your framework, then everything else. How to install FiveM resources covers adding your own.
Database settings
Many frameworks store data in a MySQL or MariaDB database. The connection is set in server.cfg as a string, commonly:
set mysql_connection_string "mysql://user:password@host/database"
Treat this line like a password, because it holds one. Never share a screenshot of your config without covering it. The exact setting name depends on the database resource you use, so read its documentation.
Permissions and admins
FiveM uses the ACE permission system. You grant a player access with their identifier:
add_ace group.admin command allow
add_principal identifier.fivem:123456 group.admin
The first line lets the admin group run commands. The second puts a player into that group, identified by their FiveM ID. Frameworks may add their own admin systems on top. Give admin power to a small group of trusted people.
Keeping the file tidy
A config that grows to hundreds of lines becomes hard to manage. A few habits help:
- Group lines with blank lines and comments, using
#at the start of a line. - Keep a copy before every change.
- Use
execto load other files, so you can split settings into smaller pieces. - Remove old lines instead of commenting them out forever.
If the server will not start after an edit, the console names the line that confused it. How to read your server logs shows how to find it, and Editing config files without breaking them lists common mistakes.
Security reminders
- Never put the license key or database password in a public repository or screenshot.
- Keep the txAdmin password strong, and do not share the admin link.
- Keep your hosting account protected. See Keep your NGP Cloud account secure.
Still stuck? Open a ticket on Discord - run /ticket in any channel, pick a department, and include your Server ID or Invoice ID so we can jump straight in.