Building web applications in Go is a rewarding experience: the language is fast, reliable, and well-suited for servers. If you’ve tried Fiber—a lightweight framework inspired by Express—you know how quickly you can spin up routes and APIs. But development is only half the story. At some point, you need to put your Fiber app online where real users can reach it.
DigitalOcean is a great place to do that. It gives you affordable, developer-friendly infrastructure with the right balance of flexibility and simplicity. In this guide, we’ll walk through deploying a Fiber application to a DigitalOcean Droplet (a virtual private server). By the end, you’ll have your app running as a supervised service, served securely over HTTPS with your own domain.
You’ll need a DigitalOcean account before getting started. Once you’re set up, the rest of the process is straightforward.
Prepare your Fiber application
Let’s start with a minimal example. If you already have an app, you can skip ahead. Otherwise, here’s the smallest possible Fiber server:
package main
import (
"log"
"github.com/gofiber/fiber/v2"
)
func main() {
app := fiber.New()
app.Get("/", func(c *fiber.Ctx) error {
return c.SendString("Hello from Fiber!")
})
log.Fatal(app.Listen(":3000"))
}Initialize your module and pull Fiber:
go mod init github.com/you/your-app
go get github.com/gofiber/fiber/v2You can run it locally with go run . and visit http://localhost:3000 to confirm it works.
Create and secure a Droplet
Head to your DigitalOcean dashboard, click Create → Droplet, and choose Ubuntu 22.04 (LTS). A small plan (1 GB RAM, 1 vCPU) is enough to start. Pick a region near your users and add your SSH key for secure login.
Once the Droplet is ready, SSH in:
ssh root@your_droplet_ipAdd a non-root user for safer day-to-day work:
adduser deploy
usermod -aG sudo deploySwitch to that user and update your system:
sudo apt update && sudo apt upgrade -yEnable a firewall:
sudo ufw allow OpenSSH
sudo ufw enableWe’ll open HTTP/HTTPS ports later when we set up the reverse proxy.
Install Go and tools
You’ll need Go on the server to build or run your project. The apt package is often outdated, so grab the latest from the official site:
cd /tmp
wget https://go.dev/dl/go1.24.5.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.24.5.linux-amd64.tar.gzAdd Go to your PATH (for example in ~/.profile):
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/binReload your shell and confirm:
go versionYou should see Go 1.24.x or newer.
Deploy your app code
Clone your repository into the server:
mkdir -p ~/app && cd ~/app
git clone https://github.com/you/your-app.git .Build the binary:
go build -o fiber-app .Test it:
./fiber-appOpen another terminal and run:
curl http://localhost:3000If you see the “Hello from Fiber!” response, your app is running. Stop it for now (Ctrl+C).
Run Fiber as a service
To keep your app running in the background and automatically restart it on errors or reboots, set up a systemd service. Create the unit file:
sudo nano /etc/systemd/system/fiber-app.servicePaste in:
[Unit]
Description=Fiber App
After=network.target
[Service]
Type=simple
User=deploy
WorkingDirectory=/home/deploy/app
ExecStart=/home/deploy/app/fiber-app
Restart=on-failure
RestartSec=5s
Environment=PORT=3000
[Install]
WantedBy=multi-user.targetReload systemd and start the service:
sudo systemctl daemon-reload
sudo systemctl start fiber-app
sudo systemctl enable fiber-appCheck status:
sudo systemctl status fiber-appYou should see it running. Logs are available with:
sudo journalctl -u fiber-app -fSet up a reverse Proxy and TLS
Right now, the app listens only on port 3000. Let’s add a reverse proxy to expose it to the web with HTTPS. Nginx is a common choice:
sudo apt install -y nginx
sudo ufw allow "Nginx Full"Create a server block:
sudo nano /etc/nginx/sites-available/dropletdrift.comAdd:
server {
listen 80;
server_name dropletdrift.com www.dropletdrift.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}Enable and restart Nginx:
sudo ln -s /etc/nginx/sites-available/dropletdrift.com /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginxPoint your domain’s A record to the Droplet’s IP. Once DNS propagates, you can issue a Let’s Encrypt certificate:
sudo apt install certbot python3-certbot-nginx
sudo certbot --nginx -d dropletdrift.com -d www.dropletdrift.comCertbot will configure TLS automatically. From here on, your Fiber app will be reachable at https://dropletdrift.com.
Optional: Continuous Deployment
If you prefer not to SSH every time you update code, set up CI/CD. For example, GitHub Actions can build your binary on push and copy it to the Droplet, then restart the service. A sample workflow:
name: Deploy
on:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.24
- run: GOOS=linux GOARCH=amd64 go build -o fiber-app
- uses: appleboy/scp-action@v0.1.0
with:
host: ${{ secrets.DROPLET_IP }}
username: deploy
key: ${{ secrets.SSH_KEY }}
source: fiber-app
target: /home/deploy/app/
- uses: appleboy/ssh-action@v0.1.0
with:
host: ${{ secrets.DROPLET_IP }}
username: deploy
key: ${{ secrets.SSH_KEY }}
script: sudo systemctl restart fiber-appThis way, deployments happen automatically when you push to main.
Troubleshooting / tips
- Ensure your firewall (UFW) allows ports 80 and 443 (if using TLS), and allows your application port internally.
- Look at
journalctl -u fiber-appfor errors (missing libraries, permission issues). - If the app fails to start under systemd but runs manually, check paths, permissions, environment variables, or hardcoded relative paths.
- If TLS fails, ensure DNS is correctly pointing, and your
server_namematches your certificate domains. - If your app needs environment variables (e.g. DB credentials), either set them in the systemd unit (
Environment=…) or use an env file. - To upgrade your app, pull new code, rebuild binary, replace the executable, then
sudo systemctl restart fiber-app.
This setup gives you full control over your stack. Once working, you can scale further (load balancers, multiple droplets, container orchestration) as needed.