# server.cfg

> Configuring a MY Multiplayer (MYMP) server with server.cfg: ensure and set directives, network, queue, event rate-limit and sync convars, and content.key encryption.

- **Platform**: MY Multiplayer (MYMP) — Lua 5.4
- **Sections**: Documentation › Server
- **Language**: English
- **URL**: https://wiki.mymp.gg/en/docs/server-config

`server.cfg` configures a **MY Multiplayer** (**MYMP**) server instance. Each line is a console command: a convar name followed by its value, `set` to define custom convars or `ensure` to start [resources](https://wiki.mymp.gg/en/docs/resources.md). Resources start in the order they appear in the file.

## Example configuration

```ini
players 64
net_port 27015
queue_size 200
server_key hz_<id>_<secret>
languages pt-BR es

set gamemode freeroam

ensure accounts
ensure [maps]
ensure shop
```

### Startup directives

- `ensure resource`: starts a single resource.
- `ensure [folder]`: starts every resource inside that subfolder, in alphabetical order.
- `set name value`: creates a custom convar that nothing declared. Scripts read it with `getConvar`.

## Core convars

| Convar                                     | Default     | Description                                                                                                                    |
| ------------------------------------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------------ |
| `resources_dir`                            | `resources` | Path to the server's resources folder.                                                                                         |
| `players`                                  | `1`         | Maximum player slots on the server.                                                                                            |
| `net_port`                                 | `27015`     | Game port (UDP). The join queue uses the same port over TCP.                                                                   |
| `http_port`                                | `22005`     | Built-in HTTP port that serves resource files to clients.                                                                      |
| `http_url`                                 |             | External HTTP mirror URL for resource files. When set, `http_port 0` disables the built-in HTTP server.                        |
| `queue_size`                               | `500`       | Maximum queue size when the server is full. `0` turns the queue off.                                                           |
| `join_rate`                                | `20`        | Rate at which queued players are let into the server.                                                                          |
| `player_triggered_event_interval`          | `1000`      | Time window, in ms, for the per-player remote event rate limit.                                                                |
| `max_player_triggered_events_per_interval` | `100`       | Maximum [remote events](https://wiki.mymp.gg/en/docs/custom-events.md) a player may trigger within the window before firing `onPlayerTriggerEventThreshold`.   |
| `server_key`                               |             | MYMP key that lists the server in the launcher. Without it, the server is unlisted and anyone joins under the name they bring. |
| `languages`                                |             | Server languages shown in the launcher, main language first (`pt-BR`, `en`, `es`).                                             |
| `min_launcher_version`                     |             | Refuses connections from launchers older than this version.                                                                    |
| `steam_api_key`                            |             | Steam Web API key used to verify players' `steam` identifiers.                                                                 |
| `password`                                 |             | Password required to join. Never logged or synced.                                                                             |

### Synchronisation convars

Network synchronisation has its own convars, whose default values are listed in the sample `server.cfg`:

- `sync_rate` and `sync_threads`
- `player_sync_interval`
- `unoccupied_vehicle_sync_interval`
- `ped_sync_interval`
- `far_state_interval`

## Resource encryption (content.key)

The first time the server starts, it generates a `content.key` file beside `server.cfg`. Client resource files are sent encrypted with this key.

- **Security**: never place `content.key` on a public HTTP mirror (`http_url`).
- **Shared cache**: servers running the same resources can share `content.key`; changing it forces every player to download all files again.
