Host Fathom Lite on a Laravel Forge Server

• 1 min read

Fathom Lite, the predecessor to Fathom, is open source website analytics software which you can host on your own servers.

As it's written in Go, running the app on your server is as straightforward as uploading the binary, starting a daemon and pointing a webserver to it.

I recently did a spring cleaning of my servers. One task was migrating my Fathom instance to a "general" server, where I host a bunch of smallish side projects. This is a quick run down, how I did that.

Use Forge's UI to create a new site on your existing server. Let's call it "fathom.example.com".

Download the latest release of Fathom Lite on GitHub and upload it to your server and the newly created "fathom.example.com" folder. (I've used good old SFTP)

If you're migrating an existing Fathom instance you can copy your existing .env-file and fathom.db database over too.

Make a note, on which port your Fathom instance is running (for example 9000)

Back in Forge, go to Servers → <Your Server> → Daemons. Create a new Daemon with the following arguments:

  • Command: /home/forge/fathom.example.com/fathom server
  • Folder: /home/forge/fathom.example.com

Switch to your "fathom.example.org" site in Forge and add the following block to your NGINX configuration.

Replace <your_ip_v4> with the IP v4 address of your server and update the port accordingly.

location / {
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
    proxy_pass http://<your_ip_v4>:9000;
}

As a final step, install a Let's Encrypt SSL certificate through Forge's UI.