Resources & Server Setup

What is server.cfg, and what do ensure and start do?

server.cfg is the plain-text configuration file a FiveM server executes line by line when it boots. It sets the network endpoints, the server name, the player slot count and the licence key, and it lists the resources to load. Resources are started with the ensure or start command followed by the folder name of the resource. A vehicle that sits in the resources folder but is never started in server.cfg does not exist as far as players are concerned.

What a minimal server.cfg looks like

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

sv_hostname "My FiveM Server"
sv_maxclients 48
sv_licenseKey "changeme"

# Default resources
ensure mapmanager
ensure chat
ensure spawnmanager
ensure sessionmanager
ensure hardcap

# Vehicles
ensure mycar
ensure [cars]
Each line is a console command; lines starting with # are comments

Every line is a command the server console would also accept while running. set and sets define settings, exec runs another .cfg file, and add_ace and add_principal grant permissions. The licence key comes from the Cfx.re portal and is required for the server to start.

Setting up a server from scratch? The Server.cfg Generator builds the file from a form. Open the Server.cfg Generator

ensure, start, stop and restart

CommandEffect
start nameStarts the resource if it is stopped.
ensure nameStarts the resource if it is stopped, restarts it if it is already running.
stop nameStops the resource.
restart nameStops and starts a running resource.
refreshRescans the resources folder so new or changed manifests are noticed.

At boot nothing is running yet, so start and ensure do the same thing. The difference shows when a command is run again on a live server: ensure guarantees the resource ends up running with its current files. That is why ensure is the usual choice in configuration files.

The name is the name of the folder that contains the resource's fxmanifest.lua, not the vehicle's spawn name, although many car resources use the same word for both.

Resource folders and order

Resources live under the server's resources directory. A folder whose name is wrapped in square brackets, such as [cars], is a category: it is not a resource itself, and the resources inside it are found automatically. ensure [cars] starts every resource in that category in one line.

text
resources/
  [cars]/
    mycar/
      fxmanifest.lua
      stream/
    policepack/
      fxmanifest.lua
      stream/
  [scripts]/
    garage/

Lines run from top to bottom, so order matters for scripts that depend on one another: a framework has to be started before the resources that use it. Vehicle resources rarely depend on anything and can be started in any order.

Common problems

  • Could not find resource: the name after ensure does not match a folder name, the folder has no manifest, or it was added while the server was running and refresh has not been run.
  • Car installed but cannot be spawned: the resource is in the folder but has no ensure line. See invalid model.
  • Same resource name twice: two folders with the same name in different categories conflict. Resource names must be unique.
  • Join times grow with every car: each car resource adds downloads and memory use. Merging cars into packs with the Car Pack Builder keeps the list short and makes conflicts visible.

The free Server.cfg Generator builds the file from a form, including hostname, tags, slots and resource order. On a txAdmin server the same ensure line is added in the CFG Editor; installing cars with txAdmin shows the whole sequence for a vehicle resource.

Frequently asked questions

What is the difference between ensure and start in server.cfg?

start only starts a resource that is stopped. ensure starts it if it is stopped and restarts it if it is already running. At server boot they behave the same.

How do I start all my car resources at once?

Put them in a category folder with a name in square brackets, for example [cars], and add the line ensure [cars] to server.cfg.

Where is server.cfg located?

In the server data folder, next to the resources directory. Its path is passed to the server with +exec server.cfg when the server is launched, or selected in txAdmin.

More in Resources & Server Setup: data_file, Add-On vs. Replace

Still need the car as a FiveM resource?

Paste a gta5-mods.com vehicle link and get a FiveM-ready resource with the manifest and metas in place. 3 free conversions, no signup.

  • 3 conversions free, no account needed
  • 2 more free if you leave an email
  • After that: $15 once for unlimited conversions and the Pro tools, no subscription