Skip to content
Run a Server

Garry's Mod server.cfg Guide

Set up server.cfg for a Garry's Mod dedicated server. Set the hostname, sv_password, rcon_password, location flag, loading screen and rate settings.

Updated 5 min read

A Garry's Mod server's server.cfg lives in garrysmod/cfg/server.cfg. The dedicated server runs it when it starts and again on every map change, so it's where your server name, passwords and other settings go.

Where the File Goes

The path starts from your server folder, the one that holds srcds:

garrysmod/cfg/server.cfg

If the file isn't there, create it as a plain text file. On Windows, turn on file extensions in File Explorer first. A file saved as server.cfg.txt won't run.

Each line is one console command or console variable, written as you'd type it into the server console. Anything after // on a line is a comment and the server ignores it.

A Starter server.cfg

Copy this, then change the values to your own:

// Name shown in the server browser
hostname "My Garry's Mod Server"

// Leave empty for a public server
sv_password ""

// Remote admin password. Make it long and never share it
rcon_password "change-this-to-something-long"

// Flag shown in the server browser
sv_location "gb"

// Server browser region. 3 is Europe
sv_region 3

// Web page shown while players join
sv_loadingurl "https://example.com/loading.html"

// Stop players running their own clientside Lua
sv_allowcslua 0

// Stop players uploading sprays
sv_allowupload 0

// Write a server log file
log on

What Each Setting Does

SettingWhat it does
hostnameThe server's name in the server browser and on the loading screen
sv_passwordA password players must enter to join. Leave it empty for a public server
rcon_passwordThe password for remote console access. If it's empty, RCON is off
sv_locationThe flag next to your server, as a two-letter country code such as gb or us. Use eu for the European Union
sv_regionThe region the server reports to Valve's server browser
sv_loadingurlA web page players see while they join. It must start with http:// or https://
sv_allowcsluaSet to 0 to stop players running clientside Lua with lua_run_cl and lua_openscript_cl
sv_allowuploadSet to 0 to turn off player sprays
log onTurns on the server's log file
hide_serverSet to 1 to hide the server from the server browser

sv_location

sv_location matches a flag icon in materials/flags16/, named by ISO 3166-1 alpha-2 country code. It takes up to five characters. Facepunch's server operator rules ban faking server information, so set it to where the server really is.

sv_region

Valve's region codes:

ValueRegion
0US East
1US West
2South America
3Europe
4Asia
5Australia
6Middle East
7Africa
255World

sv_loadingurl

Your loading page can include the joining player's details. The server replaces %s with the player's 64-bit SteamID and %m with the current map:

sv_loadingurl "https://example.com/loading.html?steamid=%s&map=%m"

The page can also define JavaScript functions that Garry's Mod calls as the player loads, such as GameDetails and SetStatusChanged. Facepunch's Loading Screen page lists all of them.

Use RCON

RCON lets you run server console commands from your own game. It uses TCP on the game port, 27015 unless you changed it with -port.

In your game's console, set the password, then put rcon before any server command:

rcon_password "change-this-to-something-long"
rcon status
rcon changelevel gm_flatgrass

Anyone with the RCON password has full control of your server. Use a long random password and change it if anyone leaves your staff team. An admin mod, covered in Install DarkRP and an Admin Mod, is safer for day-to-day moderation.

Network and Rate Settings

Valve recommends keeping the default network settings. Change them only if you know why.

SettingWhat it limits
sv_minrate, sv_maxrateThe bandwidth a player may ask for, in bytes per second. sv_maxrate 0 means unlimited
sv_minupdaterate, sv_maxupdaterateHow many snapshots a second a player may ask the server for
sv_mincmdrate, sv_maxcmdrateHow many command packets a second a player may send

The server never sends more updates than it simulates ticks. The tick rate itself is a launch option, -tickrate, not a server.cfg setting. The default is about 66.67 ticks a second, and Facepunch recommends staying between 30 and 128.

A higher tick rate costs CPU. Valve measured a tick rate of 100 using about 1.5 times the CPU of the default 66.

Settings That Go on the Command Line

Some settings must be set before the first map loads. server.cfg runs too late for them, so put them in your start script instead:

+maxplayers 32 +gamemode darkrp +map gm_construct +sv_setsteamaccount YOUR_GSLT +host_workshop_collection 123456789

sv_lan is another one. Facepunch's wiki says server.cfg sets it too late, so pass +sv_lan 0 on the command line if you need it.

autoexec.cfg

autoexec.cfg sits in the same folder, garrysmod/cfg/. The server runs it once at startup, before the first map loads. It doesn't run again on map change.

Use it for settings that only take effect after a map change. Put everything else in server.cfg, so a map change puts it back if someone changed it.

You can split a long config into several files and load them with exec. This line in server.cfg runs garrysmod/cfg/sandbox.cfg:

exec sandbox.cfg

Change Settings Without a Restart

Type any setting into the server console and it changes at once:

hostname "My Garry's Mod Server | Now Open"

That change lasts until the next map change, when server.cfg runs again. To keep it, edit server.cfg too.

Troubleshooting

Next Steps

Add addons with Workshop for Garry's Mod servers, then get listed with a GSLT and open ports.

Want to see a big DarkRP server running? Join Justified: justified.gg

More in Run a Server

All Run a Server