---
title: Server configuration
description: Every setting of the SixL server file server.json, the command-line flags, the ports, the environment variable, and how to start the server on Windows and Linux.
---

# Server configuration

The server reads one JSON file, `server.json`. This page lists every setting, the command-line flags, the ports and how to start the server. For the first start see [Make your own server](server.md).

## Rules of the file

- **The file is required.** Without it the server does not start. By default it is `server.json` in the server's working directory; `--config <file>` names another file.
- **A broken file stops the server.** JSON that does not parse, or a value of the wrong type (for example text in a port field), stops the start with one `[Config] ERROR` line that names the file, the line and the field. There is no fall back to defaults.
- **An unknown key is a warning, not an error.** The log gets `[Config] WARNING: ... unknown key '<key>' is ignored` and the start goes on. A misspelt key is therefore ignored: read the first lines of the log after every change. Key names are matched without regard to case.
- **A key you leave out keeps its default.**
- **Settings are read once, at start.** There is no reload: edit the file and restart the server.

## Settings

| Key | Type | Default | Meaning |
|---|---|---|---|
| `name` | text | `SixL server` | The server name shown in the server list. Scripts can read it as `mp.config.name`. |
| `gamemode` | text | `freeroam` | The game mode name shown in the server list. |
| `maxPlayers` | integer | `1000` | The player limit, shown in the list. Joins are refused with `full` when the players online plus join tokens not yet used reach it. |
| `language` | text | `en` | The server's language as a BCP 47 tag (`en`, `ru`, `pt-BR` ...), shown in the server list as its language. |
| `announce` | true or false | `false` | Kept and given to scripts as a server setting; the server does not act on it. Listing the server in the lobby is controlled by `lobbyToken`. |
| `url` | text | empty | The server's web address. Kept and given to scripts as a server setting; the server does not act on it. |
| `bind` | text | `0.0.0.0` | Only reported to scripts as `mp.config.bind`. It does not choose the listening address: use `bindAddress`. |
| `gamePort` | integer | `31130` | The game port. See [Ports](#ports). |
| `gameShardCount` | integer | `2` | The number of game shards (UDP ports). At least 1. More players need more shards; 20 is fine. |
| `bindAddress` | text | `127.0.0.1` | The address the entry, the game shards and voice listen on. `127.0.0.1` means this computer only; `0.0.0.0` means every network interface (needed for players on the internet); or one address. |
| `streamingRange` | number (metres) | `200` | How far players see each other and other entities: they stream in within this distance and out beyond it. Values are clamped to 1 .. 300. |
| `sharedAddresses` | list of text | empty | Addresses that many players share, for example a gateway that translates their addresses. The server-list rate limits treat such an address like a local one instead of as a single client. Bans are never by address. |
| `bridgePort` | integer | `31151` | The local TCP port for the connection between the server and the script host. Always on loopback. The local stop and status endpoint uses the next port, `bridgePort + 1`. |
| `lobbyToken` | text | empty | The token the SixL lobby gave when the server was registered (it starts with `sixl_srv_`). A server with a token reports itself to the lobby every 30 seconds and appears in the list; an empty token means the server is not listed. Keep the token out of shared files: it is the server's identity in the lobby. |
| `serverKeyPath` | text | empty | The file of the server's own encryption key for the game port: players' clients join over an encrypted connection and accept only this key, which the lobby lists with the server. Empty means `server-key.pfx` next to `server.json`; the environment variable `SIXL_SERVER_KEY_PATH` overrides it. The server makes the key on its first start: keep the file (back it up with `server.json`). Only the server's account may read it: on Linux the server creates it readable by its account only and warns when it is not; on Windows it takes the permissions of its folder, so keep the server's folder closed to other accounts, as for `server.json`. In Docker put it on a volume (the example compose file does). If the file cannot be kept, the server runs without encryption and says why in its log. |
| `requireEncryptedSessions` | true/false | false | Refuse every player whose client does not encrypt the game traffic. Clients that support it encrypt the whole session (positions, chat, voice, `callRemote` and `player.call` data) on a server with a key (`serverKeyPath`); older clients play unencrypted beside them. Turned on, older clients get the "update your client" refusal instead. Turn it on only when your players have updated. Without a kept key every join is refused, and the server says so in its log. |
| `lobbyUrl` | text | `http://lobby.sixl` | The lobby address used for the report. Leave as is. |
| `lobbyProxy` | text | `http://127.0.0.1:31128` | The local gateway through which the report reaches the lobby (the Windows archive starts it for you). Leave as is. |
| `lobbyKeys` | text | empty | The lobby's public keys that let the server verify player logins: a path to a JSON file, or the JSON text itself. Empty means the file `lobby-keys.json` next to `server.json`. See [Player logins](#player-logins). |
| `publicAddress` | text | empty | The public address of a server that is not registered in the lobby, as `host:port`: lower-case host, an IPv6 address in square brackets, an international name in its ASCII (punycode) form. See [Player logins](#player-logins). An address in another form is ignored with a warning. |
| `logLevel` | text | `Information` | `Trace`, `Debug`, `Information`, `Warning` or `Error`. Any other value means `Information`. |
| `resources` | object | see below | The client scripts the server gives to players; see [Resources and packages](packages.md). |
| `node` | object | see below | The script host. |
| `chat` | object | see below | The server's limit on each player's chat lines and commands. |

### `resources`

| Key | Default | Meaning |
|---|---|---|
| `sourceDir` | `client_packages` | The folder with the client scripts and files players download. A missing folder means the server has no client resources. |
| `buildDir` | `build/client_packages` | Where the server builds what it serves. Must be a folder of its own, outside `sourceDir`: the server writes and deletes files there. It accepts only an empty folder or an earlier build; anything else stops the server with an error and nothing is touched. |
| `maxFileBytes` | `33554432` (32 MiB) | A bigger file is left out of the build, with a warning. |
| `maxFiles` | `5000` | When there are more files, the rest are left out, with a warning. |
| `watch` | `true` | Rebuild shortly (half a second) after `sourceDir` changes. Players who join later get the new files. |

Relative paths are relative to the server's working directory.

### `node`

| Key | Default | Meaning |
|---|---|---|
| `enabled` | `true` | Start the script host. `false` runs the server without scripts. |
| `executable` | `node` | The Node.js program. A plain name is searched in `PATH`; an absolute path must exist. |
| `scriptsPath` | `../node` | The folder that holds the script host (`index.js`) and the `packages` folder with your server packages. |
| `entryPoint` | `index.js` | The script host's file inside `scriptsPath`. |
| `traceWarnings` | `true` | Start Node.js with `--trace-deprecation --trace-warnings`. |
| `nodeArgs` | none | Extra arguments for Node.js, for example `--inspect`. |

If the script host stops, the server stops too. The server does not restart it.

### `chat`

The game client already sends at most 5 lines in 3 seconds and cuts a line to 256 characters, but a modified client can send as fast as it likes. The server counts each player's chat lines and commands together; a line over the count is dropped before `playerChat` or `playerCommand`, and the log gets one line per player per window (`[Chat] player <id> sends more than ...`), not one per dropped line. A longer line is cut, not dropped. The defaults are looser than the client's, so an honest player never reaches them.

| Key | Default | Meaning |
|---|---|---|
| `maxLines` | `10` | Lines (chat and commands together) one player may send per window. `0` turns the count off. |
| `windowMs` | `3000` | The window in milliseconds; it slides (the last `windowMs` before each line). |
| `maxLength` | `256` | The longest line passed to scripts, in UTF-16 units (as JavaScript's `length`); a longer one is cut. `0` turns the cut off. |

### A small example

```json
{
  "name": "My first server",
  "maxPlayers": 50,
  "language": "en",
  "bindAddress": "0.0.0.0",
  "streamingRange": 200,
  "lobbyToken": ""
}
```

## Ports

All ports follow from `gamePort` (31130 by default):

| Port | Protocol | Setting | Purpose | Open to players? |
|---|---|---|---|---|
| `gamePort` (31130) | TCP | `gamePort` | The entry: server information, the download of client scripts and the join | Yes |
| `gamePort + 1` (31131) | UDP | `gamePort` | Voice | Yes |
| `gamePort + 2` ... (31132, 31133) | UDP | `gameShardCount` | The game shards: one port per shard | Yes, as many as shards |
| 31128 | TCP | `lobbyProxy` | The local gateway to the lobby | Never |
| `bridgePort` (31151) | TCP | `bridgePort` | Server to script host | Never (loopback only) |
| `bridgePort + 1` (31152) | TCP | `bridgePort` | Local stop and status | Never (loopback only) |

- The server does not start if the last game shard would pass port 65535, or if `gamePort` equals `bridgePort` or `bridgePort + 1`.
- Port numbers must be reachable as they are: do not remap ports on the router.
- With a kept server key (`serverKeyPath`, see [Player logins](#player-logins)) the join (with the player's login and computer serial) and the client scripts' download go over TLS, and the game traffic (positions, chat, `player.call`, `callRemote`) is encrypted for players whose client supports it. Voice is never encrypted: anyone on a player's network path can listen to it and change it. Without a kept key nothing on these ports is encrypted. Do not send passwords or other secrets between the client and the server (see [Talking between server and client](packages.md#talking-between-server-and-client)).
- Set `bindAddress` to `0.0.0.0` for a server that players on the internet join. With the default `127.0.0.1` nothing is reachable from outside this computer. The Windows archive ships with `127.0.0.1`: its first start asks nothing from the firewall. When you switch to `0.0.0.0`, Windows Firewall asks once whether `GameServer` may accept connections from the network: allow it on the networks you host on (private, or public if the server is on a public network), and open the ports above on your router.

## Player logins

Players can join as guests or with a SixL lobby account. The server checks a login offline: the lobby signs a short-lived token, and the server verifies it with the lobby's public keys from `lobbyKeys`. The player also signs a one-time challenge issued by your server, so a modified client cannot claim someone else's account. Any failure makes the player a guest.

- With the keys file in place, scripts see the verified account name as `player.login` (an empty text for a guest) and receive it as the third argument of the `incomingConnection` event.
- Without keys (the file is missing or empty) every player is a guest. This is fine for trying and developing.
- The join is encrypted: players' clients reach your game port over TLS 1.3 and accept only your server's key (see `serverKeyPath`), the one the lobby lists with your server, or for a player who joins by address, the key the client saw on the first join (an attacker on that player's network path during that very first join could show its own key instead and stay in the middle until the player forgets it; a server the lobby lists has no such first join). Keep the key file: a new key is announced to the lobby at most once an hour, and a player whose client remembers the old key is refused until they choose to forget it. Without a kept key, with a client older than this, or on the first join by address to a server that does not speak TLS, the join is plain: an attacker on the player's network path can then read the player's login, and one who can also change the traffic can take over that one join to your server. A login is still never usable on another server or for another join. The game traffic after the join (positions, chat, `callRemote` and `player.call` data; not voice) is encrypted too when the join was, and the player's client supports it; an older client plays unencrypted beside it unless `requireEncryptedSessions` is on. A player whose game traffic leaves from another internet address than the join (some VPNs with split tunnelling, some mobile networks) is refused with a message saying so, and the server counts such refusals in its log.
- A login is bound to the server it was made for. A server registered in the lobby learns its identity from the lobby after the first report. A server that is not in the lobby sets `publicAddress` to the address players use to connect, in the exact form described above; without it such a server cannot check logins.

The server archive ships the keys file next to the example configuration.

## Command-line flags

Flags override `server.json`.

| Flag | Overrides | Meaning |
|---|---|---|
| `--config <file>` | the file name | Read this file instead of `server.json`. |
| `--port <n>` | `gamePort` | The game port. |
| `--shards <n>` | `gameShardCount` | The number of game shards. |
| `--bridge-port <n>` | `bridgePort` | The bridge port. |
| `--no-node` | `node.enabled` | Do not start the script host. |
| `--log-level <level>` | `logLevel` | The log level. |
| `-v`, `--verbose` | `logLevel` | The same as `--log-level Trace`. |
| `--node-args <text>` | `node.nodeArgs` | Extra arguments for Node.js. |
| `--log-dir <folder>` | none | Where `server.log` is written. |

## Environment variable

One variable is meant for server owners:

- `SIXL_SERVER_LOG_DIR`: the folder for `server.log`, when `--log-dir` is not given. The default is a `logs` folder next to the server files.

The server does not read any other variable for its settings.

## Logs

Everything the server and the script host write to the console is also appended to `logs/server.log`. At each start the previous file is renamed to `server.1.log`, that one to `server.2.log` and so on up to `server.9.log`, so the current run and the nine before it are kept. If the folder cannot be written the server says so and runs with the console only. When the server dies, the reason is written first as a `FATAL:` line. A normal stop exits with code 0.

## Starting and stopping

### Windows

Unpack the server archive anywhere and run `start-server.cmd`. It starts the local gateway to the lobby, then the server in the same window; logs go to the `logs` folder. On the first start `server.json.example` is copied to `server\server.json`: edit it (`name`, `maxPlayers`, `lobbyToken`) and start again to apply changes. Nothing needs to be installed: the server, Node.js and the gateway are in the archive. Stop the server with Ctrl+C.

### Linux

The server for Linux comes as a container image with an example `compose.yml` and `server.json.example`. Put these next to each other:

- `compose.yml`, the example file;
- `server.json`, your configuration (start from `server.json.example`);
- `packages/`, your server packages (see [Resources and packages](packages.md));
- `client_packages/`, your client scripts.

The package is one file, `SixL-Server-linux-<version>.tar.gz`, on the lobby site's `/download/` page (the page of the launcher: over Tor or I2P), with its `.sha256` and `.sig` beside it. Check it as [Check the download](releases.md#check-the-download) shows for the launcher zip: the same commands, with the package's file name in the signed text. Then unpack it (`tar -xzf SixL-Server-linux-<version>.tar.gz`): it holds the two image files (`sixl-server-<version>.image.tar.gz` and `sixl-gateway-<version>.image.tar.gz`), `compose.yml`, `server.json.example`, `lobby-keys.json` and the `types` folder.

Load each image that comes with the release (`docker load -i <image file>`), tag it with the name the compose file expects (`sixl-server:current`; the gateway image `sixl-gateway:current` the same way), and run:

```
docker compose up -d
```

`docker compose logs -f` shows the log and `docker compose down` stops the server. The container publishes TCP 31130, UDP 31131 and UDP 31132-31133 (raise the last range together with `gameShardCount`). The file system of the container is read-only; the log is kept in a volume. If the script host stops, the container restarts. The lobby gateway runs as a second service of the same compose file and stays inside the container network: never publish its port.

### Check that it runs

Open `http://127.0.0.1:31130/info` in a browser on the same computer: the server answers with its name, the number of players, the player limit, the protocol version, the game mode and the language. In the launcher use "Connect by address" with `127.0.0.1:31130`.

### Stopping from the same computer

A request to `http://127.0.0.1:31152/shutdown` stops the server gracefully, and `http://127.0.0.1:31152/status` returns a small summary (counts of players, vehicles, objects and peds, uptime, memory). The port is `bridgePort + 1`; use it from the same computer only. Scripts' `serverShutdown` handlers have about 0.2 seconds before the process stops.

## Registering the server in the lobby

1. Open the lobby in the launcher and sign in (**Sign in**; **Sign up** / **Create account** if you have no account yet).
2. Open the **Brands** tab and press **Register a brand**. Enter the name (3-32 characters; the form shows **Available** or **Taken: ...** while you type) and an optional description, then press **Register**. You become the brand's owner and its page opens.
3. On the brand's page, in the **Servers** section, fill in the form (only the owner and the brand's admins see it): **Server name**, the address `host:port` (for example `play.example.com:31130`, the TCP entry), tags separated by commas and a description. Press **Add server**. The form reminds you which ports to open: TCP 31130, UDP 31131 and UDP 31132 and up.
4. The page shows the token (`sixl_srv_...`) in a box titled "Token of the server ... - shown only once". Copy it into `lobbyToken` in `server.json`, restart the server, then press **Saved it, hide**. The token cannot be shown again.
5. To replace a lost or leaked token, press **New token** next to the server. In the dialog type the server's name to confirm and choose **Gracefully** (the old token keeps working for 24 hours, or until the server signs in with the new one) or **At once** (the old token stops now and the server drops off the list until you put the new token into `server.json`), then press **Reissue the token**.

The server is listed as online after its first report (they repeat every 30 seconds), with its players, `maxPlayers` and `language`.
