Back Server setup guides
Terraria server hosting10 min

Terraria Dedicated Server Setup and Automated serverconfig.txt Configuration

Set up a Terraria dedicated server: Vanilla deployment, TShock/tModLoader selection, TCP 7777 forwarding, automated serverconfig.txt startup scripts, and open-source LGSM management.

The Terraria Dedicated Server offers low resource use and excellent long-term stability. Unlike "Host & Play" in single-player mode, it separates world simulation from player clients completely, letting automated farms and mechanical projects continue when the host is offline. This article covers deployment standards and configuration for Vanilla, TShock, and tModLoader servers.


1. Architecture selection matrix

Server type Features Compatibility Use cases
Vanilla Dedicated Server Official bundled server (TerrariaServer.exe) Vanilla clients only 2~8-player vanilla progression and classic survival
TShock Enhanced vanilla permission server with REST API and plugins Vanilla clients can join directly Public communities needing anti-cheat, bans, and permission groups
tModLoader dedicated server Officially supported mod container Clients must install exactly matching mods Large Calamity, Thorium, and other mod multiplayer worlds

2. Vanilla deployment and networking

1. Obtain the server

  • TerrariaServer.exe is included directly in the Steam game installation.
  • Alternatively, extract the official standalone server archive into the server directory.

2. Network port

  • Default: TCP 7777
  • Only TCP needs to be allowed in the firewall and router (not UDP).

3. Automated startup with serverconfig.txt

To avoid entering the world number and player count interactively on every startup, create serverconfig.txt in the server root:

PROPERTIES
# Absolute or relative world file path
world=C:\TerrariaServer\Worlds\MasterWorld.wld

# Size of the automatically created world if the specified world does not exist (1 small / 2 medium / 3 large)
autocreate=3

# Automatically created world difficulty (0 Classic / 1 Expert / 2 Master / 3 Journey)
difficulty=2

# World name
worldname=LanGame Terraria

# Listening port
port=7777

# Maximum players
maxplayers=16

# Join password (leave empty for no password)
password=your_secret_password

# Daily MOTD welcome message
motd=Welcome to LanGame Terraria Dedicated Server!

# Automatic save interval (minutes)
autosave=10

# Language (zh-Hans is Simplified Chinese)
language=zh-Hans

Example startup script (start_server.bat):

Batch
@echo off
TerrariaServer.exe -config serverconfig.txt

4. Choose an approach: manual configuration or LanGame Server Manager (LGSM)

Manual setup involves maintaining batch scripts and world save paths, with extra work to rotate worlds or switch modpacks.

We recommend the official open-source dedicated server management platform to simplify routine operations:

LGSM supports:

  1. Visual world management: Scan and select existing .wld files directly or create Master/Expert maps through a graphical panel.
  2. Server software switching in seconds: Switch smoothly between Vanilla, TShock, and tModLoader in one click.
  3. World snapshot protection: Package and archive the world before facing the Wall of Flesh and entering Hardmode, or before extensive terraforming, with rollback in seconds.
  4. Port conflict detection and supervision: Checks port 7777 automatically and restarts after unexpected crashes.

5. Common issues during long-term operations

1. Joining hangs at "Connecting to IP..."

  • Cause: Port 7777 often allows only UDP and omits TCP, or the router has no forwarding rule.
  • Solution: Create an explicit inbound TCP 7777 firewall rule. Confirm a public IP is available or use a virtual LAN for direct connections.

2. Locate the save path

Worlds and backups are saved by default at: C:\Users\<username>\Documents\My Games\Terraria\Worlds\ Key files are <world name>.wld and the automatically rotating <world name>.wld.bak.