Server Configuration
Complete reference for the CoD4: Modern Warfare server.cfg file.
Config File Location
main/server.cfgEdit this file via SFTP. Changes take effect after a server restart.
TIP
If you're running a mod, the mod can have its own server.cfg at mods/<modname>/server.cfg. Settings in the mod config override the main config.
Example Configuration
// ============================================================
// Server Identity
// ============================================================
set sv_hostname "My uHost CoD4 Server"
set sv_maxclients "18"
set sv_privateClients "0"
// ============================================================
// Passwords
// ============================================================
set rcon_password "changeme123"
set g_password ""
set sv_privatePassword ""
// ============================================================
// Network
// ============================================================
set sv_maxRate "25000"
set sv_floodprotect "4"
set sv_pure "1"
// ============================================================
// Downloads
// ============================================================
set sv_allowDownload "1"
// FastDL is auto-configured on uHost. No need to set
// sv_wwwDownload or sv_wwwBaseURL manually.
// ============================================================
// Gameplay
// ============================================================
set g_gametype "war"
set g_allowvote "1"
set g_antilag "1"
set g_deadChat "0"
set scr_teambalance "1"
set scr_game_allowkillcam "1"
set scr_game_hardpoints "1"
set scr_game_spectatetype "2"
// ============================================================
// Team Deathmatch Settings
// ============================================================
set scr_war_timelimit "10"
set scr_war_scorelimit "750"
set scr_war_numlives "0"
// ============================================================
// Search & Destroy Settings
// ============================================================
set scr_sd_timelimit "2.5"
set scr_sd_scorelimit "9"
set scr_sd_numlives "1"
set scr_sd_bombtimer "45"
set scr_sd_planttime "5"
set scr_sd_defusetime "5"
set scr_sd_roundswitch "3"
// ============================================================
// Map Rotation
// ============================================================
set sv_mapRotation "gametype war map mp_crash map mp_backlot map mp_strike map mp_crossfire map mp_overgrown"
set sv_mapRotationCurrent ""Settings Reference
Server Identity
| CVar | Description | Default |
|---|---|---|
sv_hostname | Server name shown in the browser and on connect. | "" |
sv_maxclients | Maximum number of player slots. | 18 |
sv_privateClients | Number of slots reserved for players who know the sv_privatePassword. Public slots = sv_maxclients minus sv_privateClients. | 0 |
sv_privatePassword | Password for reserved slots. | "" |
g_motd | Message of the day shown to players on spawn. | "" |
Passwords
| CVar | Description |
|---|---|
rcon_password | Password for remote console access. Must be at least 8 alphanumeric characters on CoD4x. |
g_password | Server join password. Leave empty for a public server. |
sv_privatePassword | Password to access reserved private slots. |
Network
| CVar | Description | Default |
|---|---|---|
sv_maxRate | Maximum data rate per client in bytes/sec. 25000 is standard. | 25000 |
sv_minRate | Minimum data rate per client. | 5000 |
sv_maxPing | Kick players with ping above this value. 0 = no limit. | 0 |
sv_minPing | Kick players with ping below this value. 0 = no limit. | 0 |
sv_floodprotect | Rate-limit chat messages to prevent spam. | 4 |
sv_timeout | Seconds before an idle client is dropped. | 40 |
sv_reconnectlimit | Max reconnect attempts per period. | 5 |
g_antilag | Lag compensation. Always keep this 1 for online play. | 1 |
File Downloads
| CVar | Description | Default |
|---|---|---|
sv_allowDownload | Allow clients to download missing files from the server. | 1 |
sv_wwwDownload | Enable HTTP redirect for faster downloads (FastDL). | Auto |
sv_wwwBaseURL | Base URL for HTTP downloads. | Auto |
sv_wwwDlDisconnected | 0 = stay connected while downloading. 1 = disconnect during download. | 0 |
sv_pure | Enforce file purity. Rejects clients with modified .iwd files. | 1 |
FastDL on uHost
FastDL is configured automatically on uHost servers. The server's built-in HTTP server (nginx) serves mod and map files at full speed. You don't need to set sv_wwwDownload or sv_wwwBaseURL unless you want to use your own external download server.
Gameplay
| CVar | Description | Values |
|---|---|---|
g_gametype | Active game mode. | dm, war, sd, sab, dom, koth |
g_allowvote | Allow players to call votes. | 0 off, 1 on |
g_deadChat | Let dead players chat to alive players. | 0 off, 1 on |
g_gravity | World gravity. | 800 (default) |
scr_teambalance | Auto-balance teams. | 0 off, 1 on |
scr_game_allowkillcam | Enable killcam. | 0 off, 1 on |
scr_game_hardpoints | Enable killstreak rewards (UAV, airstrike, helicopter). | 0 off, 1 on |
scr_game_spectatetype | Spectator mode. | 0 disabled, 1 team only, 2 free |
scr_player_maxhealth | Player health. | 100 |
scr_player_healthregentime | Seconds before health starts regenerating. | 5 |
scr_player_sprinttime | Sprint duration in seconds. | 4 |
scr_hardcore | Hardcore mode (reduced HUD, low health, friendly fire). | 0 off, 1 on |
scr_oldschool | Old School mode (weapon pickups, no classes). | 0 off, 1 on |
Friendly Fire
| CVar | Description | Values |
|---|---|---|
scr_team_fftype | Friendly fire mode. | 0 off, 1 on, 2 reflect (damage yourself), 3 shared |
Per-Game-Type Settings
Each game type has its own score and time limits. Replace <type> with the game type code (war, sd, dom, sab, dm, koth).
| CVar | Description |
|---|---|
scr_<type>_scorelimit | Score needed to win. 0 = no limit. |
scr_<type>_timelimit | Time limit in minutes. 0 = no limit. |
scr_<type>_numlives | Lives per player per round. 0 = unlimited. |
scr_<type>_roundlimit | Number of rounds. |
Search & Destroy has additional settings:
| CVar | Description | Default |
|---|---|---|
scr_sd_bombtimer | Seconds until planted bomb detonates. | 45 |
scr_sd_planttime | Seconds to plant the bomb. | 5 |
scr_sd_defusetime | Seconds to defuse the bomb. | 5 |
scr_sd_roundswitch | Switch sides after this many rounds. | 3 |
Killstreak Settings
| CVar | Description | Default |
|---|---|---|
scr_game_hardpoints | Enable killstreaks globally. | 1 |
scr_hardpoint_allowhelicopter | Allow attack helicopters. | 1 |
scr_hardpoint_allowuav | Allow UAV. | 1 |
scr_hardpoint_allowartillery | Allow airstrikes. | 1 |
Helicopter Settings
| CVar | Description |
|---|---|
scr_helicopter_health | Helicopter hit points. |
scr_helicopter_damage | Damage dealt per hit. |
Logging
| CVar | Description | Default |
|---|---|---|
g_log | Log file name. | games_mp.log |
g_logsync | Logging mode. 0 = off, 1 = buffered, 2 = continuous. | 2 |
logfile | Enable the log file. | 1 |
sv_log_damage | Log all damage events. | 0 |
Map Rotation
The sv_mapRotation CVar defines the map and game type cycle. Format:
gametype <type> map <internal_name> map <internal_name> gametype <type> map <internal_name>The gametype keyword persists until the next gametype keyword. This means you can list multiple maps under the same game type without repeating it:
// TDM on Crash and Backlot, then S&D on Strike and Vacant
set sv_mapRotation "gametype war map mp_crash map mp_backlot gametype sd map mp_strike map mp_vacant"See the Overview for the full list of map names.
FastDL (HTTP Redirect Downloads)
By default, CoD4 transfers mod and map files to clients over UDP, which is extremely slow. FastDL redirects these downloads to an HTTP server for full-speed transfers.
On uHost, FastDL is configured automatically. The server runs a built-in nginx instance that serves files from your mods/ and usermaps/ directories over HTTP. No setup is required.
If you need to use a custom download server instead:
set sv_wwwDownload "1"
set sv_wwwBaseURL "http://your-download-server.com/cod4/"
set sv_wwwDlDisconnected "0"The HTTP server directory must mirror your game server's file structure:
server/
mods/
pml220/
mod.ff
z_c_r.iwd
usermaps/
mp_custommap/
mp_custommap.ff
mp_custommap.iwd
mp_custommap_load.ff