Google Photos used to feel free until the storage meter started climbing and the bill followed. If you run a VPS already, you can move your photo backups home and keep the originals on hardware you control. Self-host Immich for photo backups and you get face recognition, timeline search, shared albums, and automatic uploads from your phone, without a monthly per-gigabyte fee.
Immich is an open-source photo and video backup app. You install it on your server, point the phone app at it, and it syncs your camera roll in the background. This guide covers a Docker Compose install on Ubuntu 24.04, a reverse proxy with HTTPS, and a backup routine so a dead disk does not take your memories with it.
Self-Host Immich for Photo Backups: What You Need First
Immich runs as several containers: a web server, a machine-learning service for thumbnails and face recognition, a PostgreSQL database, and Redis. Plan for at least 2 GB of RAM, though 4 GB makes the first big upload far less painful, and 2 CPU cores. Storage is the real constraint. Count your current photo library, add the growth you expect over two years, and leave 20% headroom on top.
Use a VPS with Docker and Docker Compose installed from the official repository, not the distribution package, which tends to lag behind. You also need a domain or subdomain, such as photos.example.com, pointed at the server, and ports 80 and 443 open for the certificate and traffic.
One warning before you start: Immich stores its library on disk and its metadata in PostgreSQL. Backing up only one of those leaves you with half a system. The backup section near the end covers both, and it is worth reading before your first upload, not after a failure.
Install Immich With Docker Compose
For an Immich Docker Compose VPS install, the official compose file is the right starting point. Create a directory for it, download the file and the example environment file, then edit the values that matter. The two settings people most often get wrong are the upload location and the database password.
mkdir -p /opt/immich && cd /opt/immich curl -o docker-compose.yml https://raw.githubusercontent.com/immich-app/immich/main/docker/docker-compose.yml curl -o .env https://raw.githubusercontent.com/immich-app/immich/main/docker/example.env nano .env
In .env, set UPLOAD_LOCATION to a directory with real space, not the root filesystem of a small boot disk. On many VPS plans that means a mounted data volume such as /mnt/data/immich. Set a long random DB_PASSWORD and record it somewhere safe; you will need it again if you ever restore the database. Leave IMMICH_VERSION on the pinned release tag.
Start the stack with docker compose up -d and watch the logs for the first minute. The machine-learning container downloads models on first boot, so it takes longer than the others. Once your Immich photo backup server is running, open http://your-server-ip:2283 and create the admin account. If the page does not load, check docker compose ps first: a container stuck in a restart loop usually points to a bad volume path or a permission problem on the upload directory.
Put Immich Behind a Reverse Proxy With HTTPS
Do not expose port 2283 to the internet and call it done. Put Immich behind Nginx, terminate TLS, and only then open it to the world. A minimal Nginx server block proxies to the Immich container and lets Certbot handle the certificate.
server {
listen 80;
server_name photos.example.com;
client_max_body_size 500M;
location / {
proxy_pass http://127.0.0.1:2283;
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;
}
}
The client_max_body_size line matters more than it looks. Phone uploads include large videos, and the default Nginx limit will reject them with a 413 error that looks like an app bug. Set it to at least 500M, or higher if you shoot a lot of 4K video. Run Certbot, confirm the site loads over HTTPS, then close port 2283 in your firewall.
If you already run other services behind a proxy, the same pattern applies. Our guide to configuring Nginx as a reverse proxy for Docker containers walks through the upstream and header details that keep WebSocket connections and large uploads working.
Connect the Phone App and Start the First Sync
Install the Immich app, enter your server URL, and sign in. Before enabling automatic backup, decide three things in the app settings: whether uploads run on mobile data or Wi-Fi only, whether the app deletes local copies after a successful upload, and which albums to include.
Leave “delete after upload” off for the first week. You want proof the server copy is intact before your phone drops the only other copy. After a few days of clean syncs, turn it on if you need the space back. The first sync of a large library can take hours, especially on a slow home upload connection. Plug the phone in, keep it on Wi-Fi, and let it run overnight. Check progress in the morning rather than assuming it finished.
Shared albums work like the ones you know from commercial services. Create an album, invite a partner or family member by their Immich account, and they can add their own photos to it. Each user gets their own storage settings in the admin panel, which helps when one person shoots far more than the rest.
Back Up Immich Properly, or the Server Is a Single Point of Failure
Self-hosting moves the risk from a cloud provider to your VPS. That trade only pays off if the photos exist in more than one place. Immich needs two things backed up: the upload directory with the original files, and the PostgreSQL database with faces, albums, and metadata.
For the files, an S3-compatible bucket is the simplest off-site target. Setting up an S3-compatible backup with Minio shows the storage side, and a nightly rsync or restic job can push the upload directory to it. For the database, schedule pg_dump from the database container and store the dump next to the file backup. Test the restore, because a backup you have never restored is a guess. Our guide to testing backup restores without breaking production shows how to rehearse a restore on a spare container instead of learning the steps during a real outage.
The rule to keep in mind is simple: your VPS, a second copy somewhere else, and one copy offline or in a different region. Our off-site backup guide for a single VPS explains the 3-2-1 approach in practical terms, including how often to run each job so the copies do not all fail together.
Common Problems and Quick Fixes
Uploads fail with a 413 error: raise client_max_body_size in Nginx and the matching limit in any proxy in front of it, then reload. The phone app reports the server as unreachable: check that the URL uses HTTPS, that the certificate is valid, and that the firewall allows 443. Faces do not appear: the machine-learning container may still be downloading models or may have run out of memory, so check its logs and give the server more RAM if it keeps restarting.
Video playback stutters in the browser: Immich transcodes video on demand, and a 2-core VPS will struggle with several 4K clips at once. Lower the transcoding quality in the admin settings, or let the server work through the queue overnight. Thumbnails missing for some files: the file may use a codec the thumbnail service does not support, in which case the original still backs up fine and only the preview is affected.
Immich vs Google Photos: What You Give Up
The Immich vs Google Photos self-hosted question comes down to control versus convenience. You lose the free tier of someone else’s storage, the instant cross-device magic that comes from a billion-user service, and the support line when something breaks at 2 a.m. You also take on updates, backups, and disk monitoring yourself. What you gain is control: no surprise pricing changes, no scanning of your library for advertising, and no account lockout risk cutting you off from your own photos.
For many VPS owners that trade is the whole point. You already pay for the server, you already maintain it, and adding a photo backup to it costs a slice of disk rather than a new subscription. If your library is small and you never think about storage, a commercial service may still be simpler. If your library keeps growing and you like owning the stack, self-host Immich for photo backups is one of the best uses of a VPS you already run.
Set it up this weekend, let the first sync finish, and back it up before you delete anything from your phone.