FiveM server.cfg Explained: Clean Template for 2026
A working FiveM server.cfg template with every line explained: endpoints, license key, OneSync, ensure order, MySQL, ACE permissions and what Portal replaced.
The FiveM server.cfg is a plain text file of console commands that FXServer runs at start. A working one needs only a few lines: endpoints, a license key, sv_maxclients, OneSync and your ensure list. Below is a clean template, then an explanation of each part and which old lines you can drop.
What does a clean FiveM server.cfg look like?
# Network
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"
# License key from portal.cfx.re
sv_licenseKey "changeme"
# Slots and sync
sv_maxclients 48
set onesync on
# Optional: lock the game build (startup only)
# sv_enforceGameBuild 3407
# Database (oxmysql)
set mysql_connection_string "mysql://user:password@localhost/dbname?charset=utf8mb4"
# Default resources
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure basic-gamemode
ensure hardcap
# Your resources, dependencies first
ensure oxmysql
ensure my-framework
ensure my-script
# Permissions
add_ace group.admin command allow
add_principal identifier.fivem:1 group.admin
Replace changeme, the database credentials and the identifier.fivem:1 example with your own values. Never post this file publicly with the real key or password in it. Lines starting with # are comments and are ignored.
Edit the file with a plain text editor. A file saved from a word processor often gets smart quotes or formatting, which can break sv_licenseKey "..." and the endpoint lines. Keep one command per line. After any change, restart the whole server rather than a single resource, and read the first minute of console output for errors.
What do the endpoint lines do?
endpoint_add_tcp creates the TCP listener and endpoint_add_udp the UDP host. Both use 0.0.0.0:30120 in the official setup examples. 0.0.0.0 means "all network interfaces on this machine", which is what you want unless the machine has several IP addresses. Change the port only if something else already uses 30120. Players connect over both protocols, so both lines must use the same port and both must be open in the firewall. See FiveM port forwarding for 30120. On FiveM for GTAV Enhanced only one endpoint is supported.
Do I still need sv_hostname and sv_projectName?
No. The server commands reference lists sv_hostname, sv_projectName, sv_projectDesc and load_server_icon as deprecated and points you to Portal. Name, description and icon now live on the Cfx.re Portal. Old lines in your file are harmless but pointless. See FiveM server banner size and Portal for what the Portal controls.
Where does the license key go?
sv_licenseKey "yourkey". You get a free key at portal.cfx.re. If the console reports that no license key is set, the server is usually not reading the file you edited. Check the working folder and whether you start with +exec server.cfg. More in the FiveM license key guide.
How do sv_maxclients and onesync work together?
According to the server commands reference, sv_maxclients accepts 1 to 2048. Values from 32 up need onesync set to on or legacy, and values above 64 need onesync on. The docs describe legacy as a compatibility mode that is not recommended because of performance issues and graphical glitches. For slots above 48, look at the Element Club options on fivem.net/server-hosting before you raise the limit. Details are in OneSync explained.
What is sv_enforceGameBuild?
It sets which game build clients load, and the docs say it can only be set at startup. The docs use sv_enforceGameBuild h4 and sv_enforceGameBuild 3407 as examples. Leave it out unless a resource needs a specific build. Your server also needs a current artifact, see which FiveM artifact to use.
In what order should I ensure resources?
ensure starts a resource, or restarts it if it is already running. Resources start in the order they appear, so put dependencies above the scripts that use them: database resource first, then your framework, then everything that needs the framework. When you add a new script, place it at the bottom of the list first and move it up only if another resource needs it earlier. That keeps the rest of the file stable while you debug. A resource that fails with a missing dependency error is usually listed too early. For the database line, a refused connection is covered in oxmysql ECONNREFUSED 3306.
What about Steam and identifiers?
The docs list the steam_webApiKey convar as deprecated. The server commands reference names its replacement, so read the current entry there before you change anything. I did not verify the replacement's exact values here. Without Steam, players are still identified by identifiers such as license: and fivem:, which most frameworks use.
How do add_ace and add_principal work?
add_ace [principal] [object] [allow|deny] grants or denies a permission. add_principal [child] [parent] makes one principal inherit another. The pair above means: whoever has identifier fivem:1 is in group.admin, and group.admin may run the command object. A deny line removes one permission from a group, for example:
add_ace group.admin command.quit deny
Grant only what staff need. ACE rules match identifiers exactly, so a wrong identifier silently gives a player no rights. Before you assume the ACE line is wrong, confirm the identifier that the server shows for that player. If you use txAdmin, its admin permissions are managed in the txAdmin panel, separate from ACE lines.
What usually doesn't help
- Adding
sv_hostnameandsets sv_projectNamelines to change the list name. Portal owns that now. - Setting
sv_scriptHookAllowed trueto fix a join problem. It allows Script Hook V clients, a security trade-off you should only accept on purpose. - Copying a giant config from a video with dozens of convars you cannot explain (community-reported source of broken servers).
- Raising
sv_maxclientswithoutonesync on.
If nothing works
Post on forum.cfx.re with your artifact build, the first red error in the console, and your server.cfg with key, passwords and IP removed. Say whether you start through txAdmin or from the command line. The profiler helps if the problem is lag rather than a startup error.
Last checked: 8 September 2026
Frequently asked questions
Where is the server.cfg file?
In your server data folder, next to the resources folder, unless you start FXServer with +exec pointing somewhere else. txAdmin shows and edits it in its CFG editor.
What is the default FiveM server port?
30120, for TCP and UDP.
How many players can a FiveM server have?
sv_maxclients allows 1 to 2048. Above 48 slots, check the Element Club options on fivem.net/server-hosting.
Do I need sv_hostname in server.cfg?
No. It is deprecated; set the name in Portal.
Why is my server.cfg not loading?
Check you started the server from the right folder or with +exec server.cfg, and that the file is named exactly server.cfg, not server.cfg.txt.
FiveM.tools was founded with sponsorship from Nyru.