Back to tutorials
Tutorial

Host Qdrant On A VPS For RAG Search With Docker

Host Qdrant on a VPS with Docker: persistent storage, API keys, TLS reverse proxy, and snapshot backups for RAG search.

By Anurag Singh
Updated on Nov 17, 2026
Category: Tutorial
Share article
Host Qdrant On A VPS For RAG Search With Docker

Vector search stops being “just a container” once you depend on it. Disks fill up. Embeddings disappear after a redeploy. Someone leaves the API open to the internet. Your “RAG feature” turns into a real incident.

This walkthrough shows you how to host Qdrant on a VPS with Docker. You’ll add persistent volumes, API key auth, and snapshot backups you can actually restore.

You’ll finish with a production-lean Qdrant endpoint on a VPS or dedicated server. It’s ready to plug into your app, internal tools, or an LLM gateway.

What you’ll build (and what you won’t)

  • Qdrant in Docker with persistent storage under /opt/qdrant
  • API key authentication so scanners and drive-by requests can’t use your vector DB
  • TLS + reverse proxy (Nginx) with timeouts that won’t explode on larger upserts
  • Backup-friendly snapshots you can copy off the box
  • Quick diagnostics to verify the full request path before you wire up RAG

You won’t build a full RAG app here. The deliverable is a hardened, backupable Qdrant endpoint. Your ingestion and retrieval code should be able to rely on it.

Prerequisites and sizing (CPU, RAM, disk)

Qdrant runs fine on a standard Linux VPS. Sizing depends on vector count, payload size, and query concurrency.

  • OS: Ubuntu 22.04/24.04, Debian 12, AlmaLinux/Rocky are fine. Commands below assume Ubuntu/Debian.
  • CPU: 2 vCPU minimum for small projects; 4–8 vCPU if you ingest continuously and serve concurrent queries.
  • RAM: 4 GB minimum; 8–16 GB is more comfortable for medium datasets and index builds.
  • Disk: NVMe helps. Budget for vectors + payloads + index overhead. 80–160 GB is a reasonable starting point for a serious app.

If this backs a customer-facing assistant or search feature, aim for predictable I/O.

Cheap shared hosts are a bad fit for write-heavy vector storage.

For a steady baseline, a HostMyCode VPS works well.

If you’d rather offload OS hardening and patching, consider managed VPS hosting.

Step 1: Prepare the VPS (packages, firewall, directories)

SSH in as a sudo-capable user. Patch the system first:

sudo apt update
sudo apt -y upgrade

Install the tools you’ll use throughout the setup:

sudo apt -y install ca-certificates curl gnupg jq nginx

Create directories for persistent storage and snapshots:

sudo mkdir -p /opt/qdrant/{storage,snapshots,config}
sudo chown -R root:root /opt/qdrant
sudo chmod -R 750 /opt/qdrant

Firewall rule of thumb: don’t expose Qdrant directly.

Publish only 80/443 to Nginx. Keep Qdrant bound to localhost or a Docker-only network.

If you use UFW, make sure SSH and Nginx can receive traffic:

sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw status

For basic abuse protection on anything internet-facing, Fail2ban is still a quick win.

This guide pairs well with Set Up Fail2ban for Nginx on Ubuntu VPS.

Step 2: Install Docker (engine + Compose plugin)

Use Docker’s official repository. You won’t get stuck on stale distro packages.

These commands install Docker Engine plus the Compose plugin:

sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg

echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo $VERSION_CODENAME) stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt update
sudo apt -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

Quick verification:

sudo docker run --rm hello-world

Step 3: Create a Docker Compose file for Qdrant (persistent volumes)

Create a dedicated Compose project directory:

sudo mkdir -p /opt/qdrant/compose
cd /opt/qdrant/compose

Create docker-compose.yml:

sudo tee /opt/qdrant/compose/docker-compose.yml > /dev/null <<'YAML'
services:
  qdrant:
    image: qdrant/qdrant:latest
    container_name: qdrant
    restart: unless-stopped
    ports:
      - "127.0.0.1:6333:6333"   # HTTP API
      - "127.0.0.1:6334:6334"   # gRPC (optional)
    volumes:
      - /opt/qdrant/storage:/qdrant/storage
      - /opt/qdrant/snapshots:/qdrant/snapshots
    environment:
      # Enable API key auth; set a strong key in the .env file below
      QDRANT__SERVICE__API_KEY: "${QDRANT_API_KEY}"
YAML

Create a .env file (Compose reads it automatically). This also locks file permissions down via umask:

sudo bash -c 'umask 077 && cat > /opt/qdrant/compose/.env <<EOF
QDRANT_API_KEY=$(openssl rand -base64 48 | tr -d "\n")
EOF'

Start the service:

cd /opt/qdrant/compose
sudo docker compose up -d

Confirm it’s running:

sudo docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"

Sanity check the API locally. First read the key (do this only in a trusted shell session):

sudo cat /opt/qdrant/compose/.env

Then hit the readiness endpoint:

QDRANT_API_KEY=$(sudo awk -F= '/QDRANT_API_KEY/ {print $2}' /opt/qdrant/compose/.env)

curl -sS -H "api-key: ${QDRANT_API_KEY}" http://127.0.0.1:6333/readyz | cat

You’re looking for HTTP 200.

A 401 means the header or key is wrong. “Connection refused” usually means the container isn’t healthy or isn’t bound where you think it is.

Step 4: Put Qdrant behind Nginx with TLS (and keep ports private)

Binding Qdrant to 127.0.0.1 prevents accidental exposure.

If your app won’t run on the same host, you still need a secure endpoint.

A practical pattern is Nginx in front for TLS termination, basic rate limiting, and timeouts that match ingestion behavior.

Start by pointing DNS (A/AAAA) at your VPS.

If you want a step-by-step DNS walkthrough, use Cloudflare DNS setup guide tutorial (2026). You can register or manage the domain via HostMyCode Domains.

Install Certbot for Nginx (Ubuntu/Debian):

sudo apt -y install certbot python3-certbot-nginx

Create an Nginx site for qdrant.yourdomain.com. Replace the server name:

sudo tee /etc/nginx/sites-available/qdrant.conf > /dev/null <<'NGINX'
limit_req_zone $binary_remote_addr zone=qdrant_ratelimit:10m rate=5r/s;

server {
    listen 80;
    server_name qdrant.yourdomain.com;

    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl http2;
    server_name qdrant.yourdomain.com;

    # Certbot will insert SSL directives here

    # Ingestion can include large JSON bodies
    client_max_body_size 50m;

    # Reasonable timeouts for batch upserts
    proxy_connect_timeout 10s;
    proxy_send_timeout 120s;
    proxy_read_timeout 120s;

    # Soft rate limiting. Tune based on your app.
    limit_req zone=qdrant_ratelimit burst=20 nodelay;

    location / {
        proxy_pass http://127.0.0.1:6333;
        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;

        # Don’t cache API responses
        add_header Cache-Control "no-store";
    }
}
NGINX

Enable the site and reload Nginx:

sudo ln -s /etc/nginx/sites-available/qdrant.conf /etc/nginx/sites-enabled/qdrant.conf
sudo nginx -t
sudo systemctl reload nginx

Request a TLS certificate:

sudo certbot --nginx -d qdrant.yourdomain.com

Test from your laptop or another server:

QDRANT_API_KEY='paste-your-key-here'
curl -i -H "api-key: ${QDRANT_API_KEY}" https://qdrant.yourdomain.com/readyz

If this should be admin-only, don’t publish it at all.

Put it behind a tunnel or VPN.

A practical option is Cloudflare Tunnel; see Set Up Cloudflare Tunnel on a VPS for Private Admin.

Step 5: Create a collection and index vectors (quick RAG-ready smoke test)

Now confirm the basics. You’ll create a collection, upsert vectors, and run a search through the full stack.

Export your API key into the current shell:

export QDRANT_API_KEY=$(sudo awk -F= '/QDRANT_API_KEY/ {print $2}' /opt/qdrant/compose/.env)

Create a collection. Use a vector size that matches your embedding model output.

Common sizes are 384, 768, 1024, and 1536.

Here’s 768:

curl -sS -X PUT "https://qdrant.yourdomain.com/collections/docs" \
  -H "Content-Type: application/json" \
  -H "api-key: ${QDRANT_API_KEY}" \
  -d '{
    "vectors": {
      "size": 768,
      "distance": "Cosine"
    }
  }' | jq

Upsert a couple of dummy points (vectors shortened here for readability; real requests send full-length arrays):

curl -sS -X PUT "https://qdrant.yourdomain.com/collections/docs/points?wait=true" \
  -H "Content-Type: application/json" \
  -H "api-key: ${QDRANT_API_KEY}" \
  -d '{
    "points": [
      {
        "id": 1,
        "vector": [0.01, 0.02, 0.03],
        "payload": {"title": "Reset password", "url": "/kb/reset"}
      },
      {
        "id": 2,
        "vector": [0.02, 0.01, 0.00],
        "payload": {"title": "Billing FAQ", "url": "/kb/billing"}
      }
    ]
  }' | jq

Important: those sample vectors are not 768-long, so Qdrant will reject them if the collection expects 768.

If you want a fast test without an embedding pipeline, set the collection size to 3 first.

Then recreate it with your real embedding size.

Search:

curl -sS -X POST "https://qdrant.yourdomain.com/collections/docs/points/search" \
  -H "Content-Type: application/json" \
  -H "api-key: ${QDRANT_API_KEY}" \
  -d '{
    "vector": [0.01, 0.02, 0.03],
    "limit": 5,
    "with_payload": true
  }' | jq

If you get scored matches and payload fields back, your path is solid.

You’ve verified TLS → Nginx → Qdrant → disk-backed storage.

Step 6: Snapshots you can back up (and restore without drama)

Embeddings are data. Back them up like data.

Qdrant supports per-collection snapshots. This makes offsite backups and restores much less painful.

Create a snapshot for the docs collection:

curl -sS -X POST "https://qdrant.yourdomain.com/collections/docs/snapshots" \
  -H "api-key: ${QDRANT_API_KEY}" | jq

List snapshots and note the snapshot name:

curl -sS "https://qdrant.yourdomain.com/collections/docs/snapshots" \
  -H "api-key: ${QDRANT_API_KEY}" | jq

On disk, snapshots land in /opt/qdrant/snapshots (mapped into the container).

Copy them off-server with whatever you already trust.

A common routine is daily snapshots, then nightly rsync to object storage or a backup VPS.

Example: find snapshot files from the last 7 days:

sudo find /opt/qdrant/snapshots -type f -name '*.snapshot' -mtime -7 -print

If you already run regular PostgreSQL backups, use the same discipline here.

Schedule it, keep retention, and test restores.

For the pattern and “restore test” mindset, this pairs well with Set Up PostgreSQL Backups With pg_dump + Restore Test (different database, same operational muscle).

Restore test (don’t skip this): The exact restore endpoint and workflow depends on whether you restore into an existing collection or a fresh one.

The safest approach is to practice on a staging VPS.

Deploy an empty Qdrant, restore the snapshot, then run a known query. You’re validating permissions, file paths, and that the offsite snapshot copy is intact.

Step 7: Operational hardening checklist (what breaks in production)

  • Don’t expose port 6333 publicly. Keep it on localhost and force access through Nginx (or a tunnel/VPN).
  • Rotate API keys. Put the key in /opt/qdrant/compose/.env with mode 600. Plan a short rotation window where the app accepts both keys.
  • Set request limits intentionally. Ingestion jobs burst. Rate limit at the public edge, not inside your private batch pipeline.
  • Watch disk usage. Payloads and snapshots grow quietly. Alert at 70–80% disk used.
  • Keep the reverse proxy timeouts realistic. Batch upserts and snapshot creation can exceed default Nginx timeouts.
  • Separate workloads. Putting your web app, primary DB, and vector DB on one small VPS creates self-inflicted “noisy neighbor” problems.

Step 8: Connect Qdrant to a typical RAG stack (practical wiring)

Your application usually does three things:

  1. Embed content (docs, tickets, product pages) into vectors.
  2. Upsert vectors + payload metadata into Qdrant.
  3. Search Qdrant at query time to retrieve relevant chunks.

If you want embeddings to stay self-hosted too, run an embeddings API locally.

Then feed Qdrant from your pipeline.

An Ollama-based embeddings endpoint is a clean option; see Self-Host Text Embeddings API With Ollama for the model-serving side.

In that setup, your app talks to two internal services: embeddings + Qdrant.

For chat UI, keep the front end separate from the vector DB host. Open WebUI is a common choice.

If you want a reference for the “private service + hardened edge” pattern, Run Open WebUI With Ollama Behind Nginx Proxy applies the same approach.

Common troubleshooting (fast checks)

  • 401 Unauthorized: The api-key header is missing or wrong. Confirm with sudo cat /opt/qdrant/compose/.env.
  • 413 Request Entity Too Large: Increase client_max_body_size in your Nginx server block. The fix pattern is the same as Nginx 413 Request Entity Too Large Fix On VPS.
  • Timeouts during upsert: Increase proxy_read_timeout and split huge batches into smaller chunks.
  • Disk grows too fast: Payloads can dwarf vectors. Store only what you need in payloads; keep full text elsewhere and reference it by ID.
  • Slow search: Check CPU steal, disk I/O wait, and RAM pressure. Heavy swapping is a sizing problem.

Summary: a production-ready Qdrant VPS setup

You now have Qdrant running with persistent volumes, API key auth, TLS termination in Nginx, and a snapshot workflow you can automate.

That combination separates a weekend prototype from something you can operate calmly.

If you’re ready to run this on real infrastructure, start with a HostMyCode VPS for small to medium datasets.

If you want patching, monitoring, and hardening handled as part of the platform, managed VPS hosting keeps the vector layer boring.

If your RAG feature is moving from demo to production, run Qdrant on a VPS with consistent disk and predictable networking. HostMyCode VPS plans fit Docker-based AI services well, and managed VPS hosting is a good option if you’d rather ship than babysit server updates.

FAQ

Should I run Qdrant on the same VPS as my web app?

You can for small workloads, but ingestion, reindexing, and large batch upserts will compete for CPU, RAM, and disk.

Putting the vector DB on its own VPS usually stabilizes latency.

Is an API key enough, or do I need IP allowlists too?

If the endpoint is private, use both. If it must be reachable from the public internet, keep the API key, terminate TLS, and use a tunnel/VPN for admin-only access.

How often should I snapshot Qdrant?

Daily is a sensible baseline. If you ingest continuously, snapshot more often and prune older snapshots with a clear retention policy.

What’s the safest way to test restores?

Restore into a staging Qdrant instance on a separate VPS, then run a known search query and compare results. Don’t make your first restore attempt during an outage.

Host Qdrant On A VPS For RAG Search With Docker | HostMyCode