Skip to Content

Immich With Cloudflare

Photo & Video Management
February 24, 2026 by
Administrator
| No comments yet

Immich Logo

Overview

If you want a fast and reliable way to self-host Immich without digging through long documentation, this guide keeps things simple. We will use Portainer to deploy the stack and Cloudflare Tunnel to make Immich securely accessible from anywhere.

Let's jump right in.


Prerequisites

This guide assumes you have comple ted the following prerequisites: - You have a server ready. - Portainer installed and configured. - Cloudflare account with the Zero-Trust portal set up.


Installation

Let's start by downloading the necessary docker files. We need two files: - Docker Compose, and - .env file

Once that is done, open your Portainer and let's get Immich up and running:

  1. Log in to Portainer.
  2. Go to Stacks → Click + Add stack.
  3. Name the stack: immich (or any name you prefer).
  4. Build method: choose Upload.
  5. Click on Select file, then choose the docker-compose-portainer.yml you downloaded.
  6. Scroll down to Environment variables.
  7. Click Load variables from .env file.
  8. Choose the stack.env file you downloaded.

If you did everything correctly, you should see environments load properly in the UI.

Environment Configuration

Variable Recommended Value Explanation
UPLOAD_LOCATION /mnt/appdata/immich/uploads Where your photos/videos will be stored.
DB_DATA_LOCATION /opt/appdata/immich/database Database storage – ideally on fast SSD for best performance.
TZ Europe/London Find yours and replace with the correct one.
DB_PASSWORD A strong 32-character password Generate a secure one using a password generator.

Secure Password Generator

••••••••••••••••••••••••••••••••

Deploy the Stack

Once you edit enviroments per your reqquiremtns click Deploy the stack. Portainer will now pull all required Docker images (this can take a few minutes) and create the containers.

Be patient! Once finished, you should see all containers listed as healthy.

Storage Tip Make sure to use a large enough drive for the UPLOAD_LOCATION variable for your photos to support your usage long term. A good starting point for just photos would be a 1TB drive.

Cloudflare Setup (Remote Access)

We will use Cloudflare Zero Trust Tunnel (free, secure, no port forwarding needed) to access Immich securely over the internet.

Lets get started:

  1. Access the ZeroTrust portal at https://one.dash.cloudflare.com/
  2. Go to Networks > Connectors.
  3. Choose your created tunnel and click the three-dot icon to choose Configure.
  4. Go to Public applications routes and click Add a published application route.
  5. Fill in the following data:
Field Value
Subdomain photos (or immich, gallery, etc.)
Domain yourdomain.com
Service HTTP
URL 127.0.0.1:2283

Click Save.

Wait 30–60 seconds for DNS propagation. Now open https://photos.yourdomain.com to see your Immich instance fully encrypted and accessible from anywhere!

Follow the Welcome Wizard to complete the setup. Once done, you are ready to connect the mobile app.

Connecting the App

Now that Immich is deployed, let’s connect the mobile app for automatic backups.

  1. Download the official Immich app for Android or iOS.
  2. Create your admin account, choose a theme, enable Version checks and Map features.
  3. Open the mobile app. It will ask you for the Server Endpoint URL.
  4. Use the exact address you set up with Cloudflare Tunnel (Example: https://photos.yourdomain.com/api).
  5. Enter the email address and password you created.
  6. Enable automatic backup by tapping the cloud icon (top right) → Select folders → choose the library you want to sync → Enable Backup.

Your phone will now automatically back up all new (and existing) photos and videos to your server.


Conclusion

You've successfully set up a self-hosted instance of Immich using Portainer and securely exposed it to the internet via Cloudflare Tunnels! The combination of Immich's powerful machine-learning photo management and robust infrastructure provides a true, privacy-respecting alternative to major cloud services right from your own server.

Enjoy!


© 2026 Kickala. All Rights Reserved.
Built for the community.
Sign in to leave a comment