[TIL]Mar 17 20263 min read

$Deploy PocketBase on a VPS: The Complete Guide

A step-by-step guide to deploying PocketBase on a Linux VPS — from installation and systemd setup to Nginx reverse proxy with SSL.

PocketBase is a lightweight, open-source backend — a single binary that gives you a database, auth, file storage, and an admin dashboard out of the box. If you're building a side project and don't want to mess with Firebase or Supabase, PocketBase is an incredibly compelling option.

Here's how to get it running on a VPS from scratch.

What You'll Need

  • A Linux VPS with SSH access (Ubuntu/Debian recommended)
  • Root or sudo privileges
  • A domain name (optional, but recommended for SSL)

Connect & Update

SSH into your server and make sure everything is up to date:

ssh username@your-vps-ip-address
sudo apt update && sudo apt upgrade -y

Install PocketBase

Download and extract the latest release into /opt:

cd /opt
sudo wget https://github.com/pocketbase/pocketbase/releases/download/v0.31.0/pocketbase_0.31.0_linux_amd64.zip
sudo apt install unzip -y
sudo unzip pocketbase_0.31.0_linux_amd64.zip -d pocketbase
cd pocketbase
sudo chmod +x pocketbase

If your VPS runs on ARM64 architecture, grab the ARM64 build from the releases page instead.

Create a Superuser & Test

sudo ./pocketbase superuser create your-email@example.com your-password
sudo ./pocketbase serve

PocketBase will start on http://127.0.0.1:8090. Hit Ctrl+C to stop once you've confirmed it works.

Run It as a Systemd Service

You don't want PocketBase dying when your SSH session closes. Create a systemd service:

sudo nano /etc/systemd/system/pocketbase.service

Paste this in:

[Unit]
Description=PocketBase
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/opt/pocketbase
ExecStart=/opt/pocketbase/pocketbase serve --http="0.0.0.0:8090"
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

Then enable and start it:

sudo systemctl daemon-reload
sudo systemctl enable pocketbase
sudo systemctl start pocketbase
sudo systemctl status pocketbase

At this point, PocketBase is accessible at http://your-vps-ip:8090/_/. If you have UFW enabled, open the port:

sudo ufw allow 8090/tcp
sudo ufw reload

Set Up a Domain with Nginx + SSL

Running on a raw IP and port isn't great for production. Let's put Nginx in front and add SSL.

Install Nginx:

sudo apt install nginx -y

Create a config at /etc/nginx/sites-available/pocketbase:

server {
    listen 80;
    server_name your-domain.com;

    location / {
        proxy_pass http://127.0.0.1:8090;
        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 it and grab an SSL cert:

sudo ln -s /etc/nginx/sites-available/pocketbase /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com

Now your PocketBase instance lives at https://your-domain.com/_/.

Handy Commands

ActionCommand
Stopsudo systemctl stop pocketbase
Restartsudo systemctl restart pocketbase
Tail logssudo journalctl -u pocketbase -f
Help./pocketbase --help

A Word of Caution

PocketBase is pre-v1.0 — backward compatibility isn't guaranteed between releases. It's fantastic for side projects and prototypes, but if you're running anything mission-critical, keep a close eye on the changelog and be ready to handle migrations manually.

Your data lives in the pb_data directory next to the binary. Back it up regularly.


That's it. A full backend — auth, database, file storage, admin UI — deployed in under 10 minutes. PocketBase is one of those tools that makes you wonder why everything else has to be so complicated.

#pocketbase#vps#self-hosting#backend#nginx#ssl#devops#tutorial
Deploy PocketBase on a VPS: The Complete Guide | Terminal Log