Back to blog
Blog

Deploy Immich On A VPS For Private Photo Backups

Deploy Immich on a VPS for private photo backups with TLS, storage planning, updates, and backups that actually restore.

By Anurag Singh
Updated on Nov 18, 2026
Category: Blog
Share article
Deploy Immich On A VPS For Private Photo Backups

Running out of space in Google Photos or iCloud usually isn’t the real issue. The bigger problem is dependency. Pricing changes, accounts get locked, and “helpful” compression can touch your originals.

If you want control back, you can deploy Immich on a VPS and keep files, metadata, and access rules on infrastructure you run.

This is an open-source spotlight on Immich. It covers what it replaces, who it fits, and what a “production-ish” VPS setup looks like.

Expect Docker Compose, an HTTPS reverse proxy, storage layout, backups, and low-drama updates.

It assumes you already operate servers. You just want that same predictability for photos.

Why Immich is worth self-hosting (and who it fits)

Immich is a self-hosted photo and video backup platform with a web UI and mobile apps. Your phone uploads in the background to your server. You can browse or search from anywhere.

The features most people actually care about:

  • Automatic mobile backups (with album selection and background sync).
  • Fast browsing at scale via generated thumbnails and previews.
  • Local AI features such as face recognition and object search (runs on your server).
  • EXIF, maps, and timeline views that feel familiar if you’re coming from Google Photos.
  • Multi-user support and sharing, useful for families or small teams.

Immich fits well if you want one private library for originals, easy remote access over HTTPS, and costs that track your infrastructure.

It’s a weaker fit if you need compliance workflows, legal hold, or enterprise eDiscovery. That’s a different class of tooling.

License note: Immich is open source. Check the current license and any “enterprise” features in the upstream repository before you base business processes on it.

Deploy Immich on a VPS: what you need first

Before you touch Docker, handle the boring parts. Photo libraries usually fail in predictable ways.

Disks fill up, backups aren’t tested, and TLS gets ignored.

This checklist avoids most of that pain:

  • A domain name (e.g., photos.example.com). If you need one, use HostMyCode domains.
  • A VPS with enough RAM to keep the database and background jobs comfortable.
  • Storage you can grow: either a larger VPS disk, attached block storage, or a second mounted volume.
  • Outbound email (optional) if you want invite emails/reset flows; not required for a single-user setup.
  • A backup destination that is not the same VPS (object storage, another server, or an offsite box).

If you don’t want to manage OS updates and baseline hardening, managed VPS hosting is the simplest route.

If you prefer full control, a standard HostMyCode VPS works well for Immich.

Immich vs Google Photos / iCloud: the trade you’re making

You’re trading a polished, fully managed consumer product for control and visibility. That’s a win if you want to own the stack. It’s a headache if you don’t.

  • What you gain: originals stored under your rules, server-side features that don’t require handing images to a third party, and costs that map to your disk usage instead of account tiers.
  • What you take on: patching, watching disk growth, making backups, testing restores, and keeping remote access tight.
  • What’s different: Immich runs compute-heavy jobs (thumbnails, metadata extraction, ML indexing). Google/iCloud absorb that cost; your VPS will now do it.

The most common gotcha is underestimating storage. The runner-up is having backups that look fine on paper but fail on restore.

Sizing for a real library: CPU, RAM, and disk planning

Immich will run on a small VPS for light use, but it prefers headroom. Sizing depends on library size and how fast you want imports and indexing to finish.

  • Personal library (up to ~200k photos/videos): 2–4 vCPU, 4–8 GB RAM is comfortable for most users.
  • Family / multi-user: 4 vCPU, 8–16 GB RAM reduces queue buildup during big imports.
  • Storage: start with at least 2× your current on-device usage. Previews and thumbnails add overhead, and you’ll want slack space for database growth and maintenance.

Disk I/O matters as much as capacity. NVMe-backed storage can noticeably cut thumbnail generation time.

It also keeps browsing responsive while background work runs.

If you expect heavy usage, choose a plan built for sustained I/O. You can always move to a dedicated box later.

Rule of thumb for operators: keep at least 20% free disk space. Below that, databases and background workers start behaving “mysteriously.”

It rarely looks like a storage issue at first.

Deployment model: Docker Compose on Ubuntu LTS

Immich’s maintainers support a Docker-based deployment. On a VPS, it’s usually the lowest-friction option.

The example below assumes Ubuntu LTS on a fresh VM. It also assumes a working directory at /opt/immich.

Install Docker Engine and the Compose plugin:

sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg

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-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

sudo usermod -aG docker $USER

Create a working directory and pull the upstream Compose template. Immich publishes a docker-compose.yml and an .env file in its repository.

Start there instead of copying random third-party snippets.

sudo mkdir -p /opt/immich
sudo chown -R $USER:$USER /opt/immich
cd /opt/immich

From here, follow the official Immich docs to fetch the current Compose files. Avoid hardcoding version numbers in your own notes unless you’re intentionally pinning them.

Where to store data: plan ahead if you expect the library to grow. Put the upload/library path on a mounted volume like /mnt/photos. Then bind-mount it into the containers.

This keeps expansions and migrations simple. Your media won’t be buried in the root filesystem.

Put Immich behind a reverse proxy with HTTPS

Expose Immich like any production web app. Put it behind a reverse proxy, enable TLS, and set sane headers.

Avoid exposing random container ports to the internet.

You can use Nginx or Caddy. For small deployments, Caddy is hard to beat. It automates Let’s Encrypt certificates, and the config stays readable.

Example Caddyfile for photos.example.com (path: /etc/caddy/Caddyfile):

photos.example.com {
  encode zstd gzip

  header {
    Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
    X-Content-Type-Options "nosniff"
    X-Frame-Options "SAMEORIGIN"
    Referrer-Policy "strict-origin-when-cross-origin"
  }

  reverse_proxy 127.0.0.1:2283
}

Bind Immich to localhost only (or a private Docker network). Let Caddy be the only public entry point.

If you already run Caddy for other services, this is just another site block.

If you prefer Nginx, the shape is identical: terminate TLS and proxy to the Immich web service.

For more on TLS automation and common reverse-proxy setups, our Caddy + DNS wildcard SSL guide is a useful reference. It’s especially helpful if you want a wildcard cert for multiple subdomains.

Storage layout that won’t paint you into a corner

Immich is database-backed and file-heavy. Treat those as separate backup surfaces from day one.

  • Database volume: PostgreSQL data directory (inside a Docker volume or a bind mount). This is not optional to back up.
  • Uploads/library path: where originals live. Put this on a volume you can expand independently.
  • Config and Compose files: /opt/immich, including your .env and any proxy config.

Many VPS providers let you expand the system disk. Mount points still matter, though.

A simple, stable layout:

  • / on the system disk
  • /mnt/immich-library on an attached volume (ext4 or xfs)
  • Docker volumes for databases, backed up via dumps (not by copying live files)

If you host other apps on the same machine, isolate Immich storage. That way, a big import can’t fill the partition your sites depend on.

If this is multi-tenant hosting or you run heavy web workloads, a separate VPS for Immich is usually the calmer option.

Backups that restore: database dumps + file snapshots

Backups are where self-hosted photo platforms either pay off or bite you. Plan on two mechanisms, not one:

  • Consistent database backups (logical dumps) so you can restore to a clean PostgreSQL instance.
  • File backups for the library path, ideally with versioning (ransomware and accidental deletes happen).

Database dump (example): if your Immich stack includes PostgreSQL, run pg_dump from inside the container. You can also run it via a utility container on the same network.

Schedule it with cron, and store it off-host.

# Example pattern (adjust service/container names for your compose file)
cd /opt/immich
mkdir -p /opt/backups/immich

# Dump to a timestamped file
docker compose exec -T postgres pg_dump -U postgres -d immich | gzip > /opt/backups/immich/immich-db-$(date +%F).sql.gz

Then push /opt/backups/immich offsite (rsync to another server, rclone to object storage, or your existing backup system).

If you want a more operator-minded workflow, borrow the restore-testing approach from our pg_dump + restore test guide.

Library backups: for /mnt/immich-library, use restic, borg, or ZFS snapshots if you run ZFS.

Whatever tool you choose, make sure it checks these boxes:

  • Incremental (your library will grow forever)
  • Encrypted (photos are sensitive)
  • Offsite (a VPS loss should not be a data loss)
  • Tested restore of both a single file and a full directory

A workable rhythm for most setups: nightly database dumps, nightly library backups, and weekly restore tests on a spare VM or local machine.

Updates without surprises (and a quick rollback plan)

Containers make updates convenient. They don’t make updates safe automatically.

Keep the process boring. Read notes, back up, then update.

  1. Read upstream release notes for breaking changes (schema migrations, config changes, renamed containers).
  2. Take backups right before you pull new images (database dump + confirm last offsite sync completed).
  3. Update and verify (containers healthy, web UI loads, mobile upload works).

Typical Compose update flow:

cd /opt/immich
docker compose pull
docker compose up -d
docker image prune -f

Rollback thinking: keep the previous images until you’ve confirmed everything behaves.

If an update runs a DB migration, rollback may require a database restore from pre-upgrade backups.

That’s why the backup step is non-negotiable.

Security basics for an internet-facing photo library

Immich will store private media. Treat it the way you’d treat customer data.

  • SSH hygiene: disable password auth, use keys, limit access by IP if possible.
  • Firewall: allow only 22/tcp (SSH), 80/443 (web). Don’t expose database ports.
  • Fail2ban: not mandatory, but useful if your proxy logs authentication attempts. If you run Nginx for multiple apps, our Fail2ban for Nginx guide is a good baseline.
  • Separate users and strong passwords: especially for family setups. Enable 2FA if Immich supports it in your chosen auth configuration.
  • Keep the host patched: kernel and OpenSSL updates still matter even if the app is containerized.

If you don’t need Immich publicly reachable, put it behind a private access layer (VPN or an authenticated tunnel). That’s a different operating model.

For single-user libraries, it’s often the right one.

Operational checks: what to monitor weekly

Immich doesn’t need an SRE team. It does need a few routine checks.

Catching issues early is the difference between a quick fix and a weekend rebuild.

  • Disk free: alert at 80% and 90% usage on both the system disk and the library volume.
  • Database growth: if the DB volume grows unusually fast, investigate logs and job queues.
  • Background jobs: thumbnail/ML queues should drain. If they climb forever, you’re CPU-bound or misconfigured.
  • Backup status: last successful offsite sync time, plus a periodic restore test.

If you already run dashboards, reuse what you have.

If you’re starting fresh, the approach in our Grafana VPS deployment post pairs well with node exporter/cAdvisor metrics for container hosts.

Migration notes: bringing an existing library into Immich

Most migrations start with a directory tree from a NAS, an external drive, or a Google Takeout/iCloud export. This is where your sizing assumptions get tested.

  • Stage data locally first on the server’s library volume. Imports over slow network mounts are painful.
  • Expect high CPU while Immich generates previews and runs indexing. That’s normal.
  • Don’t multitask huge imports with other production workloads on the same VPS.

If you’re moving several services at once (sites, email, apps, plus Immich), consider using HostMyCode migrations for the hosting side.

That lets you focus on application cutover and data validation.

Summary: a practical self-hosted alternative to cloud photo lockers

Immich works well if your goal is simple. Your phone backs up to your server, you keep originals, and you can browse/search without renting storage from a vendor.

The work is operational. Focus on storage planning, HTTPS, backups, and updates. You don’t need exotic engineering.

If you want consistent performance for uploads, indexing, and browsing, start with enough RAM and decent I/O.

A well-sized HostMyCode VPS handles most personal and family libraries comfortably. If a single VM stops making sense, you can move to dedicated servers.

If you’re ready to self-host Immich, choose a VPS with NVMe storage and enough RAM to keep background jobs moving. HostMyCode VPS plans fit most personal and family libraries, and managed VPS hosting is a good option if you’d rather not own OS patching and baseline hardening.

FAQ

Can I run Immich on the same VPS as my websites?

You can, but big imports can make you regret it. Immich will spike CPU and disk I/O while it generates previews and indexes media. If your websites are revenue-critical, put Immich on its own VPS.

Do I need a GPU for Immich?

No. A GPU can speed up some machine-learning tasks, but a CPU-only VPS is fine for most libraries. If ML indexing feels slow, add vCPU and RAM before you shop for specialized hardware.

What’s the minimum safe backup plan?

Nightly PostgreSQL dumps plus nightly incremental backups of the library directory, stored offsite. Add a monthly restore test where you rebuild Immich on a clean VM and confirm browsing works.

Should I expose Immich directly to the internet?

If you need remote access, expose it via HTTPS behind a reverse proxy and keep the app containers private. If you don’t need public access, a VPN or authenticated tunnel cuts your attack surface.

How do I update Immich without breaking things?

Read upstream notes, take a pre-upgrade backup, then pull images and restart with Docker Compose. Keep old images until you confirm the web UI and mobile uploads work as expected.

Deploy Immich On A VPS For Private Photo Backups | HostMyCode