# Complete Guide: Setting Up Sons Of The Forest Server with Pangolin

**URL:** <https://forum.hhf.technology/t/complete-guide-setting-up-sons-of-the-forest-server-with-pangolin/3520>\
**Category:** Self-hosted Applications\
**Tags:** sons-of-the-forest, pangolin\
**Created:** [August 12, 2025, 1:23am UTC](https://forum.hhf.technology/t/complete-guide-setting-up-sons-of-the-forest-server-with-pangolin/3520 "2025-08-12T01:23:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hhf.technoloy](https://forum.hhf.technology/user_avatar/forum.hhf.technology/hhf.technoloy/32/68_2.png) [@hhf.technoloy](https://forum.hhf.technology/u/hhf.technoloy)\
**Post date:** [August 12, 2025, 1:23am UTC](https://forum.hhf.technology/t/complete-guide-setting-up-sons-of-the-forest-server-with-pangolin/3520/1 "2025-08-12T01:23:38Z")

</div>

# Complete Guide: Setting Up Sons Of The Forest Server with Pangolin

This guide will walk you through setting up a dedicated Sons Of The Forest (SOTF) game server and exposing it securely to the internet using Pangolin tunneling solution.

## Table of Contents

1. Prerequisites

2. Part 1: Server Preparation

3. Part 2: Pangolin Installation

4. Part 3: SOTF Server Setup

5. Part 4: Configuring Traefik for UDP Ports

6. Part 5: Newt Tunnel Configuration

7. Part 6: Exposing SOTF Ports via Pangolin

8. Part 7: Server Configuration

9. Part 8: Testing and Connection

10. Troubleshooting

## Prerequisites

Before starting, ensure you have:

- **Server/VPS** : A Linux server with at least 8GB RAM (16GB recommended)

- **Operating System** : Ubuntu 20.04/22.04 or Debian 11/12

- **Docker and Docker Compose** : Installed on your server

- **Domain Name** : A registered domain pointed to your server

- **Open Ports** : The following ports must be open on your server firewall:

- **Pangolin Account** : Sign up at [pangolin.io](https://pangolin.io/)

- **Sons Of The Forest** : Game copy on Steam (for testing)

- **Storage** : At least 20GB free space for server files

## Part 1: Server Preparation

### Step 1: Connect to Your Server

```auto
ssh user@your-server-ip

```

### Step 2: Install Docker (if not already installed)

```auto
# Update package list
sudo apt update

# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

# Add your user to docker group
sudo usermod -aG docker $USER

# Log out and back in for group changes
exit
ssh user@your-server-ip

```

### Step 3: Install Docker Compose

```auto
# Download Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

# Make it executable
sudo chmod +x /usr/local/bin/docker-compose

# Verify installation
docker compose --version

```

### Step 4: Configure Firewall

```auto
# Using ufw (Ubuntu/Debian)
sudo ufw allow 22/tcp # SSH
sudo ufw allow 80/tcp # HTTP
sudo ufw allow 443/tcp # HTTPS
sudo ufw allow 51820/udp # Pangolin
sudo ufw allow 21820/udp # Pangolin
sudo ufw allow 8766/udp # SOTF Game
sudo ufw allow 27016/udp # SOTF Query
sudo ufw allow 9700/udp # SOTF Steam

# Enable firewall
sudo ufw enable

# Verify rules
sudo ufw status

```

Expected output:

```auto
To Action From
-- ------ ----
22/tcp ALLOW Anywhere
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
51820/udp ALLOW Anywhere
21820/udp ALLOW Anywhere
8766/udp ALLOW Anywhere
27016/udp ALLOW Anywhere
9700/udp ALLOW Anywhere

```

## Part 2: Pangolin Installation

### Step 1: Install Pangolin Base

```auto
cd ~
mkdir pangolin
cd pangolin

# Download and run the Pangolin installer
curl -fsSL https://get.pangolin.io | bash

```

### Step 2: Configure Pangolin Installation

Follow the installer prompts:

1. Choose **Docker** as the container type

2. Enter your base domain (e.g., `example.com`)

3. Enter dashboard subdomain (e.g., `pangolin.example.com`)

4. Enter email for Let’s Encrypt certificates

5. Configure email settings (optional, can skip)

6. Choose to install Gerbil (recommended: **yes** )

### Step 3: Verify Pangolin Installation

```auto
docker ps

```

You should see containers:

- pangolin

- gerbil

- traefik

## Part 3: SOTF Server Setup

### Step 1: Create Project Directory

```auto
cd ~
mkdir sotf-server
cd sotf-server

```

### Step 2: Create Directory Structure

```auto
mkdir -p config data container-data

```

### Step 3: Create Dockerfile for SOTF Server

```auto
nano container-data/Containerfile

```

Add the following content:

```auto
FROM rouhim/sons-of-the-forest-server:latest

# Additional configurations can be added here if needed

```

### Step 4: Create Docker Compose File

```auto
nano docker-compose.yml

```

Add the following configuration:

```auto
services:
  sotf_newt:
    image: ghcr.io/fosrl/newt:latest
    container_name: sotf_newt
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      - PANGOLIN_ENDPOINT=https://pangolin.your-domain.com # Update this
      - NEWT_ID=XXXXXXX # Will be replaced later
      - NEWT_SECRET=XXXXXXX # Will be replaced later
      - DOCKER_SOCKET=/var/run/docker.sock
      - ACCEPT_CLIENTS=true
    networks:
      - pangolin

  sons-of-the-forest-dedicated-server:
    container_name: sons-of-the-forest-dedicated-server
    image: jammsen/sons-of-the-forest-dedicated-server:latest
    restart: always
    environment:
      PUID: 1000
      PGID: 1000
      ALWAYS_UPDATE_ON_START: true
      SKIP_NETWORK_ACCESSIBILITY_TEST: true
    volumes:
      - ./game:/sonsoftheforest
    ports:
      - "0.0.0.0:8766:8766/udp"
      - "0.0.0.0:27016:27016/udp"
      - "0.0.0.0:9700:9700/udp"
    logging:
      driver: "json-file"
      options:
        max-size: "50m"
    networks:
      - pangolin

networks:
  pangolin:
    external: true

```

## Part 4: Configuring Traefik for UDP Ports

### Step 1: Edit Traefik Configuration

```auto
cd ~/pangolin
nano config/traefik/traefik_config.yml

```

### Step 2: Add SOTF UDP Entrypoints

Make sure your entryPoints section includes:

```auto
entryPoints:
  web:
    address: ":80"
    http:
      redirections:
        entryPoint:
          to: websecure
          scheme: https
          permanent: true
  
  websecure:
    address: ":443"
    transport:
      respondingTimeouts:
        readTimeout: "30m"
    http:
      tls:
        certResolver: "letsencrypt"
  
  # Sons Of The Forest UDP ports
  udp-27016:
    address: ":27016/udp"
  
  udp-9700:
    address: ":9700/udp"
  
  udp-8766:
    address: ":8766/udp"

providers:
  docker:
    endpoint: "unix:///var/run/docker.sock"
    exposedByDefault: false
  file:
    directory: "/etc/traefik/dynamic"
    watch: true
  http:
    endpoint: "http://pangolin:3001/api/v1/traefik-config"
    pollInterval: "5s"

certificatesResolvers:
  letsencrypt:
    acme:
      email: your-email@example.com # Update this
      storage: /letsencrypt/acme.json
      httpChallenge:
        entryPoint: web

```

### Step 3: Update Gerbil Port Mappings

```auto
nano docker-compose.yml

```

Ensure the gerbil service has the SOTF ports:

```auto
  gerbil:
    image: docker.io/fosrl/gerbil:latest
    container_name: gerbil
    ports:
      - 51820:51820/udp
      - 21820:21820/udp
      - 443:443
      - 80:80
      - 27016:27016/udp # SOTF Query Port
      - 9700:9700/udp # SOTF Steam Port
      - 8766:8766/udp # SOTF Game Port

```

### Step 4: Enable Raw Resources

```auto
nano config/config.yml

```

Add or ensure this flag is set:

```auto
flags:
  allow_raw_resources: true

```

### Step 5: Restart Pangolin Stack

```auto
docker compose down
docker compose up -d

```

## Part 5: Newt Tunnel Configuration

### Step 1: Access Pangolin Dashboard

Navigate to:

```auto
https://pangolin.your-domain.com

```

### Step 2: Create Organization (if needed)

1. Click **“Create Organization”**

2. Enter organization name (e.g., “Gaming”)

3. Click **“Create”**

### Step 3: Create Site

1. Go to **“Sites”** tab

2. Click **“Add Site”**

3. Enter site name (e.g., “SOTF-Server”)

4. Click **“Create Site”**

### Step 4: Get Newt Credentials

1. Click on your newly created site

2. Copy the **NEWT\_ID** and **NEWT\_SECRET** values

3. Note the **PANGOLIN\_ENDPOINT** URL

### Step 5: Update Docker Compose with Newt Credentials

```auto
cd ~/sotf-server
nano docker-compose.yml

```

Replace the placeholder values:

```auto
environment:
  - PANGOLIN_ENDPOINT=https://pangolin.your-domain.com
  - NEWT_ID=your-actual-newt-id
  - NEWT_SECRET=your-actual-newt-secret

```

### Step 6: Start SOTF Server Stack

```auto
docker compose up -d

```

### Step 7: Verify Newt Connection

```auto
docker logs sotf_newt

```

You should see: “Successfully connected to Pangolin endpoint”

## Part 6: Exposing SOTF Ports via Pangolin

### Step 1: Create Resource for Port 8766 (Game Port)

In Pangolin Dashboard:

1. Go to **“Resources”** tab

2. Click **“Add Resource”**

3. Configure:

4. Click **“Create Resource”**

### Step 2: Configure Target for Port 8766

1. In the resource settings page

2. Under **“Target Configuration”** , add:

3. Click **“Save Targets”**

### Step 3: Create Resource for Port 27016 (Query Port)

1. Click **“Add Resource”**

2. Configure:

3. Click **“Create Resource”**

4. Add target:

5. Click **“Save Targets”**

### Step 4: Create Resource for Port 9700 (Steam Port)

1. Click **“Add Resource”**

2. Configure:

3. Click **“Create Resource”**

4. Add target:

5. Click **“Save Targets”**

## Part 7: Server Configuration

### Step 1: Create Server Configuration File

```auto
cd ~/sotf-server
nano config/dedicatedserver.cfg

```

Add your server configuration:

```auto
{
  "ServerName": "My SOTF Pangolin Server",
  "MaxPlayers": 8,
  "Password": "",
  "LanOnly": false,
  "SaveSlot": 1,
  "SaveMode": "Continue",
  "GameMode": "Normal",
  "SaveInterval": 600,
  "IdleDayCycleSpeed": 0.0,
  "IdleTargetFramerate": 5,
  "ActiveTargetFramerate": 60,
  "LogFilesEnabled": false,
  "TimestampLogFilenames": true,
  "TimestampLogEntries": true,
  "SkipNetworkAccessibilityTest": false,
  "GameSettings": {
    "Difficulty": "Normal",
    "TreeRegrowth": true,
    "BuildingDestruction": true,
    "EnemiesEnabled": true,
    "EnemyAggression": "Normal",
    "EnemyArmour": "Normal",
    "EnemyHealthMultiplier": "Normal",
    "EnemyDamageMultiplier": "Normal",
    "EnemyRespawnMultiplier": "Normal",
    "AnimalSpawnRate": "Normal"
  },
  "CustomGameModeSettings": {}
}

```

### Step 2: Configure Server Permissions (Optional)

```auto
nano config/ownerswhitelist.txt

```

Add Steam IDs of server admins (one per line):

```auto
76561198000000000
76561198000000001

```

### Step 3: Set Environment Variables

Update docker-compose.yml with server settings:

```auto
environment:
  FAST_BOOT: "true"
  SERVER_NAME: "My SOTF Pangolin Server"
  MAX_PLAYERS: "8"
  PASSWORD: "myserverpass" # Optional
  SAVE_INTERVAL: "600"
  SERVER_PORT: "8766"
  QUERY_PORT: "27016"
  STEAM_PORT: "9700"

```

### Step 4: Restart Server with Configuration

```auto
docker compose down
docker compose up -d

```

## Part 8: Testing and Connection

### Step 1: Verify Server is Running

```auto
docker logs sotf_server

```

Look for messages indicating the server has started successfully.

### Step 2: Check Port Accessibility

```auto
# Test UDP ports locally
nc -u -v localhost 8766
nc -u -v localhost 27016
nc -u -v localhost 9700

```

### Step 3: Get Your Server Connection Info

Your server will be accessible at:

```auto
Server IP: your-org.pangolin.io
Game Port: 8766
Query Port: 27016

```

### Step 4: Connect via Sons Of The Forest

#### Method 1: Direct Connection

1. Launch Sons Of The Forest

2. Click **“Multiplayer”**

3. Click **“Join”**

4. Click **“Dedicated”**

5. Enter IP: `your-org.pangolin.io:8766`

#### Method 2: Server Browser

Your server should appear in the server browser if configured correctly. Look for your server name.

#### Method 3: Steam Server Browser

1. Open Steam

2. View → Servers

3. Add server: `your-org.pangolin.io:27016`

### Step 5: Verify Connection

Once connected, verify:

- Player can join successfully

- Game saves properly

- No connection timeouts

- Check server logs for player activity

## Troubleshooting

### Server Not Starting

```auto
# Check logs
docker logs sotf_server -f

# Verify container status
docker ps -a

# Check disk space
df -h

```

### Cannot Connect to Server

1. **Verify UDP ports are open:**

```auto
sudo netstat -tulnp | grep -E '8766|27016|9700'

```

1. **Check Traefik logs:**

```auto
docker logs traefik | grep -E '8766|27016|9700'

```

1. **Verify Newt tunnel:**

```auto
docker logs sotf_newt

```

1. **Test port forwarding:**

```auto
# From another machine
nc -u -v your-org.pangolin.io 8766

```

### Server Shows Offline in Browser

- Ensure Query Port (27016) is properly configured

- Check that all three UDP ports are exposed

- Verify `SkipNetworkAccessibilityTest` is set to false

### Performance Issues

1. **Increase server resources:**

```auto
services:
  sons-of-the-forest-server:
    mem_limit: 8g
    cpus: '4.0'

```

1. **Optimize server settings:**

```auto
{
  "IdleTargetFramerate": 5,
  "ActiveTargetFramerate": 30,
  "LogFilesEnabled": false
}

```

1. **Monitor resource usage:**

```auto
docker stats sotf_server

```

### Save Game Issues

```auto
# Check save directory permissions
ls -la ~/sotf-server/data/

# Fix permissions if needed
sudo chown -R 1000:1000 ~/sotf-server/data/

```

### Server Crashes

```auto
# Check system logs
dmesg | tail -50

# Increase container restart delay
nano docker-compose.yml
# Add under restart policy:
restart: unless-stopped
deploy:
  restart_policy:
    delay: 10s

```

## Maintenance

### Backup Server Data

```auto
#!/bin/bash
# Create backup script
cat > backup-sotf.sh << 'EOF'
#!/bin/bash
BACKUP_DIR="/home/user/sotf-backups"
DATE=$(date +%Y%m%d_%H%M%S)
mkdir -p $BACKUP_DIR
tar -czf "$BACKUP_DIR/sotf-backup-$DATE.tar.gz" -C /home/user/sotf-server data/ config/
# Keep only last 7 days of backups
find $BACKUP_DIR -name "sotf-backup-*.tar.gz" -mtime +7 -delete
EOF

chmod +x backup-sotf.sh

# Add to crontab (daily at 3 AM)
crontab -e
# Add line:
0 3 * * * /home/user/backup-sotf.sh

```

### Update Server

```auto
cd ~/sotf-server

# Pull latest image
docker compose pull sons-of-the-forest-server

# Backup before update
./backup-sotf.sh

# Restart with new image
docker compose down
docker compose up -d

```

### Monitor Server Health

```auto
# Create monitoring script
cat > monitor-sotf.sh << 'EOF'
#!/bin/bash
if ! docker ps | grep -q sotf_server; then
    echo "SOTF Server is down! Restarting..."
    cd /home/user/sotf-server
    docker-compose up -d
fi
EOF

chmod +x monitor-sotf.sh

# Add to crontab (check every 5 minutes)
*/5 * * * * /home/user/monitor-sotf.sh

```

## Security Recommendations

1. **Use Strong Passwords** : Always set a server password for public servers

2. **Whitelist Admins** : Use ownerswhitelist.txt for admin control

3. **Regular Backups** : Implement automated backup strategy

4. **Monitor Logs** : Regularly check for suspicious activity

5. **Update Regularly** : Keep Docker images and server updated

6. **Resource Limits** : Set Docker resource limits to prevent DoS

7. **Firewall Rules** : Only open required ports

8. **Access Control** : Use Pangolin’s authentication features if needed

## Performance Tuning

### For Large Servers (16+ players)

```auto
environment:
  ActiveTargetFramerate: "30"
  IdleTargetFramerate: "5"
  LogFilesEnabled: "false"

```

### Network Optimization

```auto
environment:
  NETWORK_QUALITY: "3" # 0=Low, 3=Ultra
  NETWORK_BUFFER_SIZE: "2048"

```

## Conclusion

You now have a fully functional Sons Of The Forest dedicated server running through Pangolin’s secure tunneling system! Your server is accessible via your custom domain and all three UDP ports (8766, 27016, 9700) are properly exposed for full game functionality.

Remember that UDP traffic cannot use proxy protocol, so all players will appear to connect from the same IP (the proxy). This is normal behavior and doesn’t affect gameplay.

For support and updates:

- SOTF Server Image: [jammsen](https://github.com/jammsen)[docker-sons-of-the-forest-dedicated-server](https://github.com/jammsen/docker-sons-of-the-forest-dedicated-server)

- Pangolin Documentation: [docs.pangolin.io](https://docs.pangolin.io/)

- Game Updates: Check Steam for Sons Of The Forest updates
