Pterodactyl and LigHTTPd

Pterodactyl is an open-source game hosting panel designed for resellers, and cleverly uses Docker to spin up nicely sandboxed gameservers.  It’s simple and provides built-in and community-made “eggs” (docker container build scripts and port allotment tools) for popular games like Minecraft and CS:GO, making it one of the most powerful game hosting tools on the market.

Now, I don’t plan to enter that market, but I do have a group of friends that occasionally likes to start up a server every now and then, and I feel a lot more comfortable giving them access to an idiot-proof gamepanel rather than an actual shell.

So, that’s the story of how I found myself throwing Pterodactyl on my dedicated server, only to discover that I needed to cobble together my own lighttpd configuration for it.

What You’ll Need

I’m not going to get into the nitty-gritty of installing pre-requisites, so you’ll need the following done first:

  • Working PHP >= 7.4 installation (pref. PHP 8)
  • Working MariaDB installation
    • A working MariaDB user and database for Pterodactyl’s panel ONLY (not root, see Pterodactyl’s docs)
  • Working LigHTTPd installation with php integration (fpm recommended)
    • mod_rewrite (to handle URL rewrites)
  • A usable DNS address for the panel (either CNAME or A/AAAA records)
  • Root shell access on your server (or sudo)

The Configuration

Near the top of /etc/lighttpd/lighttpd.conf, ensure that mod_rewrite is enabled (See server.modules).

At the bottom of /etc/lighttpd/lighttpd.conf, add the following:

$HTTP["host"] == "your.pterodactyl.panel.hostname.tld" {
                 "^/(assets|themes|js|favicons)/(.)$" => "$0",
                 "^/(.)" => "/index.php/$1"

Now just install Pterodactyl Panel like you usually would. I use mod_evhost, so I installed the panel to /host/hostname.tld and symlinked htdocs to Pterodactyl’s installed public directory.