EN

Game servers

Serve Garry's Mod Content with FastDL and Nginx

Set up FastDL for Garry's Mod with Nginx: bzip2 compression, sv_downloadurl, resource.AddFile, secure publishing, verification, rollback and troubleshooting.

7 min read, updated on 18 November 2026

On this page

Your values

Enter them once and the commands in this guide update.

This guide explains how to send your custom content to players through FastDL, from a dedicated Nginx site: preparing the files, compression, publishing, server configuration and rollback.

HostMyServers does not offer managed game hosting: you administer this server yourself on your VPS or dedicated server.

Should You Use FastDL?

Method Speed Use for
Workshop (resource.AddWorkshop) Fastest Any content that can be published on the Workshop, preferred
FastDL (sv_downloadurl) Fast, file by file Content you cannot publish on the Workshop
Download from the game server (sv_allowdownload) Limited to 64 KB/s To be avoided

.lua files are not affected: the game sends them through another mechanism.

How It Works

  1. The server marks files for download with resource.AddFile. These files must exist on the game server
  2. The player receives the address set in sv_downloadurl
  3. For each missing file, they first request the compressed version, then the normal version:
Text
http://fastdl.your-domain.com/materials/my_server/logo.vmt.bz2
http://fastdl.your-domain.com/materials/my_server/logo.vmt

The path on the website must therefore be identical to the path in garrysmod/.

Prerequisites

  • A server installed with the Create a Garry's Mod Server guide. This guide builds on its gmod user, the /home/gmod/gmod-server folder and the gmod.service service
  • SSH access with sudo
  • A subdomain, here fastdl.your-domain.com, with a DNS A record pointing to the server's IP address
  • TCP port 80 available: if another site already uses Nginx on this server, this guide simply adds a separate site

Check the DNS before continuing:

Terminal
getent hosts fastdl.your-domain.com

Step 1: Back Up the Configuration

Terminal
sudo -u gmod cp -p /home/gmod/gmod-server/garrysmod/cfg/server.cfg /home/gmod/server.cfg.before-fastdl
sudo -u gmod ls -l /home/gmod/server.cfg.before-fastdl

Step 2: Install Nginx and bzip2

Terminal
sudo apt update
sudo apt install -y nginx bzip2

Then create the site folder. It belongs to gmod, which publishes the files there, and remains readable by Nginx, which runs as www-data with Debian and Ubuntu packages:

Terminal
sudo install -d -o gmod -g www-data -m 2750 /var/www/gmod-fastdl /var/www/gmod-fastdl/releases
sudo ls -ld /var/www/gmod-fastdl /var/www/gmod-fastdl/releases

The permissions displayed must be drwxr-s---, with gmod and www-data as owners.

Step 3: Add Your Content

Your files must exist on the game server. Group them in an addon, following the game's folder structure and using only lowercase:

Text
garrysmod/addons/my_content/
├── materials/my_server/logo.vmt
├── materials/my_server/logo.vtf
├── models/my_server/crate.mdl
└── sound/my_server/announcement.mp3

If you uploaded these files to the ~/my_content folder of your administration account, copy them like this:

Terminal
sudo mkdir -p /home/gmod/gmod-server/garrysmod/addons/my_content
sudo cp -r ~/my_content/. /home/gmod/gmod-server/garrysmod/addons/my_content/
sudo chown -R gmod:gmod /home/gmod/gmod-server/garrysmod/addons/my_content

Step 4: Create the Publishing Script

This script copies the allowed file types, compresses them and publishes everything in a new release. It keeps recent releases so you can roll back.

Terminal
sudo -u gmod nano /home/gmod/fastdl-sync.sh
Terminal
#!/bin/bash
set -euo pipefail
umask 027

GAME="/home/gmod/gmod-server/garrysmod"
WEB="/var/www/gmod-fastdl"
KEEP=3

# Folders to publish, each organized like garrysmod/
SOURCES=(
    "$GAME/addons/my_content"
    "$GAME/gamemodes/darkrp/content"
)

NEW="$WEB/releases/$(date +%Y-%m-%d_%H-%M-%S)"
mkdir "$NEW"

for src in "${SOURCES[@]}"; do
    [ -d "$src" ] || continue
    cd "$src"
    for dir in maps materials models particles resource sound; do
        [ -d "$dir" ] || continue
        find "$dir" -type f \( \
            -iname '*.bsp' -o -iname '*.vmt' -o -iname '*.vtf' -o -iname '*.png' -o -iname '*.jpg' \
            -o -iname '*.mdl' -o -iname '*.vvd' -o -iname '*.vtx' -o -iname '*.phy' -o -iname '*.ani' \
            -o -iname '*.pcf' -o -iname '*.ttf' -o -iname '*.otf' \
            -o -iname '*.wav' -o -iname '*.mp3' -o -iname '*.ogg' \
        \) -print0 | while IFS= read -r -d '' file; do
            mkdir -p "$NEW/$(dirname "$file")"
            cp -- "$file" "$NEW/$file"
            bzip2 -9 -k -f -- "$NEW/$file"
        done
    done
done

count=$(find "$NEW" -type f ! -name '*.bz2' | wc -l)
if [ "$count" -eq 0 ]; then
    rm -rf "$NEW"
    echo "No files to publish: current version kept." >&2
    exit 1
fi

ln -sfn "$NEW" "$WEB/current"

# Delete the oldest releases
ls -1dt "$WEB"/releases/* | tail -n +$((KEEP + 1)) | xargs -r rm -rf --

echo "Publishing complete: $count files in $NEW"

Make the script executable, then run it:

Terminal
sudo -u gmod chmod 700 /home/gmod/fastdl-sync.sh
sudo -u gmod /home/gmod/fastdl-sync.sh

The gamemodes/darkrp/content folder is skipped if it does not exist. It is listed because DarkRP marks some of its files with resource.AddFile: they must therefore also be available on FastDL. Add to SOURCES any other addon whose content is marked.

Step 5: Configure Nginx

Terminal
sudo nano /etc/nginx/sites-available/gmod-fastdl
Nginx
server {
    listen 80;
    listen [::]:80;
    server_name fastdl.your-domain.com;

    root /var/www/gmod-fastdl/current;
    autoindex off;
    gzip off;

    types { }
    default_type application/octet-stream;
    add_header X-Content-Type-Options nosniff always;

    access_log /var/log/nginx/gmod-fastdl.access.log;
    error_log /var/log/nginx/gmod-fastdl.error.log;

    location / {
        return 404;
    }

    location ~ ^/(maps|materials|models|particles|resource|sound)/ {
        limit_except GET {
            deny all;
        }
        try_files $uri =404;
    }
}

Only the content folders are accessible. Enable the site, test the configuration and reload Nginx:

Terminal
sudo ln -s /etc/nginx/sites-available/gmod-fastdl /etc/nginx/sites-enabled/gmod-fastdl
sudo nginx -t
sudo systemctl reload nginx

nginx -t must report syntax is ok and test is successful.

Step 6: Open Port 80

Use the firewall tool already in place on your server.

With UFW

Terminal
sudo ufw allow 80/tcp
sudo ufw reload

With iptables

Terminal
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables-save | sudo tee /etc/iptables/rules.v4

With nftables

Terminal
sudo nft add rule inet filter input tcp dport 80 accept
(echo "flush ruleset"; sudo nft list ruleset) | sudo tee /etc/nftables.conf

Step 7: Check the Site

Test one of your files, adapting its path. The first command must answer 200:

Terminal
curl -I http://fastdl.your-domain.com/materials/my_server/logo.vmt.bz2
curl -fsS http://fastdl.your-domain.com/materials/my_server/logo.vmt.bz2 | bunzip2 | sudo -u gmod cmp - /home/gmod/gmod-server/garrysmod/addons/my_content/materials/my_server/logo.vmt

The cmp command must display nothing: the published file is then identical to the original.

Also check that nothing else is accessible. These two requests must answer 404:

Terminal
curl -I http://fastdl.your-domain.com/
curl -I http://fastdl.your-domain.com/cfg/server.cfg

Step 8: Mark the Files for Download

Create a server-side Lua file:

Terminal
sudo -u gmod mkdir -p /home/gmod/gmod-server/garrysmod/lua/autorun/server
sudo -u gmod nano /home/gmod/gmod-server/garrysmod/lua/autorun/server/fastdl.lua
lua
resource.AddFile( "materials/my_server/logo.vmt" )
resource.AddFile( "models/my_server/crate.mdl" )
resource.AddFile( "sound/my_server/announcement.mp3" )

Give the path starting from garrysmod/, without addons/my_content/ and without .bz2. resource.AddFile also adds related files: the .vtf of a .vmt, or the .vvd, .vtx and .phy of a .mdl. The game limits this list to 8192 files.

Step 9: Enable FastDL on the Server

Terminal
sudo -u gmod nano /home/gmod/gmod-server/garrysmod/cfg/server.cfg

Add these lines, with no trailing / on the address:

Text
sv_downloadurl "http://fastdl.your-domain.com"
sv_allowdownload 0

sv_allowdownload 0 disables direct download from the game server, which is slow and open to abuse. Restart the server:

Terminal
sudo systemctl restart gmod.service

Step 10: Check in Game

  1. On the server, follow the requests:

    Terminal
    sudo tail -f /var/log/nginx/gmod-fastdl.access.log
  2. On your computer, delete the test content from the garrysmod/download/ folder if it exists

  3. Connect to the server

Requests for your .bz2 files must appear with the 200 code, and the content must show up in game. Press Ctrl+C to stop following the log.

Updating Content

The game does not compare file contents: a player who already has a file does not download it again, even if it changed. To distribute a new version, give the file a new name and adapt fastdl.lua as well as the references to the file.

Then publish, and restart the server if fastdl.lua changed:

Terminal
sudo -u gmod /home/gmod/fastdl-sync.sh
sudo systemctl restart gmod.service

Rolling Back

Go Back to a Previous Release

Terminal
sudo -u gmod ls -1t /var/www/gmod-fastdl/releases
sudo -u gmod ln -sfn /var/www/gmod-fastdl/releases/YYYY-MM-DD_HH-MM-SS /var/www/gmod-fastdl/current

The change is immediate, with no Nginx restart.

Disable FastDL

Terminal
sudo systemctl stop gmod.service
sudo -u gmod cp -p /home/gmod/server.cfg.before-fastdl /home/gmod/gmod-server/garrysmod/cfg/server.cfg
sudo -u gmod rm -f /home/gmod/gmod-server/garrysmod/lua/autorun/server/fastdl.lua
sudo rm -f /etc/nginx/sites-enabled/gmod-fastdl
sudo nginx -t && sudo systemctl reload nginx
sudo systemctl start gmod.service

The copy of server.cfg does not include changes made after step 1: reapply them if needed.

Troubleshooting

HTTP ERROR 1 (Zero Length File) downloading ... or HTTP ERROR 2 (Connection closed) downloading ...

These messages appear in the player's console. Check that sv_downloadurl starts with http://, that the Cloudflare proxy is disabled on the subdomain and that the indicated file answers with curl -I.

The Nginx Log Shows 404 Errors

The file is not published, or its path differs. List the failing requests:

Terminal
sudo awk '$9 == 404 {print $7}' /var/log/nginx/gmod-fastdl.access.log | sort | uniq -c | sort -rn | head

Check the case of the path, add its folder to SOURCES if needed and run the script again. Requests to / or other unrelated addresses often come from bots and can be ignored.

The Nginx Log Shows 403 Errors or Permission denied

Check each permission level:

Terminal
sudo namei -l /var/www/gmod-fastdl/current/materials

The folders must belong to the www-data group. If you published as a user other than gmod, fix the permissions, then run the script again:

Terminal
sudo chown -R gmod:www-data /var/www/gmod-fastdl

mkdir: cannot create directory ... Permission denied

The script was not run as gmod, or the folder was not created in step 2. Use sudo -u gmod /home/gmod/fastdl-sync.sh.

No files to publish

The source folder is empty, or the files are not in materials, models, sound or another recognized folder. Check the folder structure from step 3.

bind() to 0.0.0.0:80 failed (98: Address already in use)

Another service is using port 80. Identify it with sudo ss -ltnp | grep ':80 '.

Players Download Nothing

  • Check the active value with rcon sv_downloadurl
  • Check that the file is marked in fastdl.lua and present on the game server: otherwise, it is not added to the list
  • The player may have limited downloads in their options. The cl_downloadfilter command in their console must be set to all
  • The file may already be in their garrysmod/download/ folder

Players Still See the Old Version

This is normal game behavior. Rename the file, as described in the update section.

FAQ

Should I publish Workshop addons on FastDL?

No. Use resource.AddWorkshop, described in the server installation guide.

Can I host FastDL on another server?

Yes. Install Nginx on that machine and copy the contents of current there with rsync or scp. The files must remain on the game server, otherwise resource.AddFile does not add them to the list.

Are .bz2 files mandatory?

No, but they reduce the transferred volume. The script also keeps the normal version, used if the compressed version is missing.