Setting up your FiveM server: license key, server.cfg, and resources
Get a FiveM server running properly: generate a free Cfx.re license key, understand server.cfg, and add resources the right way.
A FiveM server needs three things to run: a free Cfx.re license key, a working server.cfg, and your resources (scripts, maps, and frameworks). This guide gets all three right so your server boots and shows up in the server list.
1. Generate a Cfx.re license key
Every FiveM server needs a license key from Cfx.re's keymaster. It's free.
- Go to keymaster.fivem.net and sign in with your Cfx.re (Forum) account.
- Click New server key / Register.
- For the IP, you can register a key to your server's IP or generate an unlisted key (fine for most setups). Note: a key is tied to how you register it, so if you ever change servers you may need a new key.
- Copy the key. It looks like a long random string.
2. Add the key to server.cfg
-
Open your server and click File Manager.
-
Open
server.cfgin the root. -
Find the
sv_licenseKeyline (or add one) and paste your key:sv_licenseKey your_key_here -
Save and restart from the Console tab.
Without a valid key the console will print Invalid license key and the server won't come online.
3. Understand server.cfg
server.cfg is the heart of your server. The lines you'll touch most:
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
sv_hostname "My ServerPrism FiveM Server"
sv_maxclients 32
sets locale "en-US"
# Load resources
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure my-custom-resource
sv_licenseKey your_key_here
sv_hostname: your server's name in the FiveM server browser.sv_maxclients: player slots (up to 48 on default builds).ensure <name>: starts a resource on boot. This is how you enable scripts.
You don't need to edit the endpoint lines. They are set to your server's own port (the one in the Address on Overview) automatically on every start, so the
30120in the example above is replaced by your real port.
4. Add resources
Resources (scripts, maps, frameworks like ESX or QBCore) go in the resources/ folder.
- Upload the resource folder into
resources/via the File Manager or SFTP (SFTP is better for large frameworks, see File Manager & SFTP). - Add an
ensure <resource-name>line toserver.cfgfor each one you want running. - Restart. Watch the console: each resource prints
Started resource <name>when it loads.
For a full roleplay framework, install its base resources in the order its docs specify (usually a database + core framework first, then dependent scripts).
Databases (ESX/QBCore)
Roleplay frameworks need a MySQL database. Create one on the Databases tab and point the framework's config (usually via mysql_connection_string in server.cfg or a framework config file) at the credentials. See Creating and connecting to a MySQL database.
Same-node database quirk: if your DB and FiveM server are on the same node and the framework can't connect over the public IP, open a support ticket. This is a known networking case we can fix quickly by bridging the containers.
Common issues
Invalid license key: the key is wrong, expired, or registered to a different IP. Regenerate it in keymaster.- Server not in the browser: it's still booting,
sv_hostnameisn't set, or a resource is erroring. Read the console for the firsterror. - A resource fails to start: check the console for the first error line under that resource; it's usually a missing dependency or a database it can't reach.
ghmattimysql/oxmysqlerrors: the database connection string is wrong. Copy the credentials fresh from the Databases tab.
Still stuck?
Open a support ticket with the first error line from your console and the resource it mentions. We can dig into the config on the node directly.