Skip to content
🧮 Is Lifetime with ZapX Pass worth it? Work it out for your own servers in 30 seconds. Open the Lifetime calculator →

Set Up PhotoPrism on a Linux Server – Your Own Photo Library as an Alternative to Google Photos

Set up PhotoPrism as a One-Click App or with Docker on your VPS, and manage your photos yourself with AI-powered search, facial recognition, and maps.

2 December 202613 min read4 Views0 helpful

Introduction

PhotoPrism is a self-hosted photo and video management solution with AI features, and an alternative to Google Photos or Apple Photos. PhotoPrism scans your photos and videos, recognizes subjects and faces, places photos with GPS data on a map, and makes your entire collection searchable—for example, by “beach,” a location, a year, or a camera. You can open PhotoPrism in a browser on any device, and on your smartphone you can also install it as a web app.

In this guide, we’ll show you two ways to get started: the easy way with a One-Click App, which runs PhotoPrism with a generated administrator password and HTTPS at your address, and a manual installation with Docker Compose. After that, you’ll upload photos, connect your smartphone, and learn what PhotoPrism can and can’t do without a membership.

When PhotoPrism Makes Sense on a VPS

PhotoPrism is a good choice if:

  • You don’t want your photos stored with a cloud provider. Your originals, thumbnails, and database are stored on your own server.
  • You want to make an existing collection searchable. PhotoPrism preserves your folder structure, reads metadata such as the date taken, camera, and GPS data, and automatically adds keywords.
  • You want to share photos with family or friends. You can share albums and individual photos via a link, without requiring recipients to have an account.
  • You work with photos from different sources. In addition to JPEG, PhotoPrism handles HEIC from iPhones, RAW files from many cameras, and videos.

PhotoPrism is less suitable if you’re mainly looking for an automatic backup of your phone’s camera roll through a dedicated app. Immich is a better fit for that. If you need files, calendars, and contacts in addition to photos, take a look at Nextcloud.

PhotoPrism or Immich?

Both programs manage photos on your own server, but they focus on different things:

PhotoPrismImmich
FocusSearching, organizing, and sharing a collectionAutomatically backing up phone photos
SmartphoneBrowser-based web app; upload via browser or WebDAV appDedicated Android and iOS app with background uploads
Existing foldersPreserved with their folder structureUsually added as an external library
Multiple usersAdditional roles require a membershipMultiple users included by default

If you mainly want to organize a large photo archive from your computer or an old hard drive, PhotoPrism is a strong choice. If automatic smartphone backups are your priority, Immich is usually more convenient.

Easy Option: PhotoPrism as a One-Click App

The quickest way to get PhotoPrism is through your VPS’s One-Click Apps. With a domain, the app is directly accessible over HTTPS. The One-Click App sets up the database, reverse proxy, and certificate for you, and ZapX generates your administrator account password during installation.

Requirements

  • A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. See Setting Up One-Click Apps for instructions.
  • PhotoPrism needs at least 2 vCores and 2 GB of RAM for the app; 4 vCores and 4 GB are recommended. Image recognition and thumbnail generation require a lot of processing power, and more cores significantly speed up the initial scan.
  • Make sure you have enough disk space: the image takes up around 3.7 GB, in addition to your originals and thumbnails. For a photo collection, plan for at least 50 GB of free space.

Install

  1. Open your VPS in the ZapX dashboard and switch to the One-Click Apps tab.
  2. Search the App catalog for PhotoPrism and click Install app.
  3. Use a custom subdomain or zap.cloud is already selected. Leave this option enabled and enter a name, for example photos. Without a domain, PhotoPrism would only be accessible over HTTP, and your password would be transmitted unencrypted.
  4. You don’t need to enter anything under App configuration. ZapX generates the three passwords for PhotoPrism and the database.
  5. Click Queue installation. The first time, the VPS downloads the image, which is around 1 GB, and PhotoPrism then sets up the database. After about two to three minutes, the app card will show the app as online.

First Login

  1. In the app settings (gear icon), open the App environment tab. Under Automatically generated values, find SERVICE_PASSWORD_PHOTOPRISM. Click the eye icon to show the password, or the icon next to it to copy it.
  2. Open the app’s Access link.
  3. Sign in with the username admin and this password, then click Sign in.

The username admin is fixed. Sign-in is always enabled for the One-Click App: visitors only see the sign-in page unless they log in, and WebDAV access also requires a username and password. The other two values under Automatically generated values are for the MariaDB database. You won’t need them for everyday use.

Warning: Change your password in PhotoPrism, not in the App Environment

SERVICE_PASSWORD_PHOTOPRISM is only for your first sign-in. After that, change your password in PhotoPrism under Settings > Account > Change Password. The new password remains valid after restarts and updates. The value in the App environment is outdated after that; changing it there will not reset your password.

What the One-Click App Sets Up

The One-Click App starts two containers: photoprism, with the web interface, image recognition, and WebDAV server, and mariadb, which serves as the database. The database is only accessible within the app, while PhotoPrism itself is accessible only through your domain. Data is stored in three volumes:

  • photoprism-originals: your originals, meaning uploaded photos and videos.
  • photoprism-storage: thumbnails, settings, sidecar files with metadata, and automatic database backups.
  • photoprism-database: the MariaDB database with albums, keywords, people, and ratings.

The interface is set to English. Under Settings > General, select German under Language. This guide uses the English labels.

Updates and Backups

To check whether a new version is available, open the app settings (gear icon), go to App update, and click Check for updates. Install a new version by clicking Apply update. If the page says the app is up to date, there isn’t a newer version in the app catalog. Your photos, albums, and settings are preserved during updates.

PhotoPrism automatically creates a database backup once a day in the photoprism-storage volume and keeps the last three. This protects you from database errors, but not from losing the entire server. So back up your VPS from the Backups tab to protect your originals, thumbnails, and database together. For large collections, it’s also worth keeping a copy of your originals on another storage location, for example via WebDAV (see “Upload and Scan Photos”).

Manual Installation

The rest of this guide describes a manual installation of PhotoPrism with Docker Compose on your VPS—for example, if you don’t use One-Click Apps on the server or want to manage PhotoPrism yourself alongside other services. The instructions are based on the official Docker Compose guide.

Requirements

  • A Linux VPS running Debian or Ubuntu, with SSH access. See First Access via SSH.
  • Docker and Docker Compose. See Install Docker. Check the installation with docker --version and docker compose version.
  • For HTTPS: a domain or subdomain whose A record points to your VPS’s IP address (e.g., photos.example.com).
MinimumRecommended
CPU2 vCores4 vCores
RAM2 GB for PhotoPrism4 GB
Storage5 GB plus photos50 GB or more

According to the official documentation, the server should have at least 3 GB of RAM in total, plus an additional 4 GB of swap. When scanning large images and videos, PhotoPrism temporarily needs significantly more memory; without swap, the container may stop. Depending on your collection, thumbnails can take up additional space equivalent to some of the space used by the originals.

Prepare the Firewall

PhotoPrism listens on port 2342 inside the container. Don’t open this port, because PhotoPrism should only be accessible through a reverse proxy with HTTPS. With ufw, allow only SSH and the ports required by the reverse proxy:

Code
sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
sudo ufw status

In the Compose file below, port 2342 is bound only to 127.0.0.1. This means only the reverse proxy on the same server can access it, even if Docker sets its own firewall rules.

Install with Docker Compose

Create a folder for PhotoPrism and generate random passwords for the administrator account and database. They’ll be saved in the .env file:

Code
mkdir -p ~/photoprism && cd ~/photoprism
echo "ADMIN_PASSWORD=$(openssl rand -hex 12)" > .env
echo "DB_PASSWORD=$(openssl rand -hex 24)" >> .env
echo "DB_ROOT_PASSWORD=$(openssl rand -hex 24)" >> .env
chmod 600 .env

Then create a compose.yaml file in the ~/photoprism folder, for example with nano compose.yaml:

Code
services:
  photoprism:
    image: photoprism/photoprism:261029
    restart: unless-stopped
    stop_grace_period: 15s
    depends_on:
      - mariadb
    security_opt:
      - seccomp:unconfined
      - apparmor:unconfined
    ports:
      - "127.0.0.1:2342:2342"
    environment:
      PHOTOPRISM_ADMIN_USER: "admin"
      PHOTOPRISM_ADMIN_PASSWORD: "${ADMIN_PASSWORD}"
      PHOTOPRISM_AUTH_MODE: "password"
      PHOTOPRISM_SITE_URL: "https://photos.example.com/"
      PHOTOPRISM_DISABLE_TLS: "true"
      PHOTOPRISM_DEFAULT_LOCALE: "de"
      PHOTOPRISM_ORIGINALS_LIMIT: 5000
      PHOTOPRISM_UPLOAD_LIMIT: 5000
      PHOTOPRISM_DATABASE_DRIVER: "mysql"
      PHOTOPRISM_DATABASE_SERVER: "mariadb:3306"
      PHOTOPRISM_DATABASE_NAME: "photoprism"
      PHOTOPRISM_DATABASE_USER: "photoprism"
      PHOTOPRISM_DATABASE_PASSWORD: "${DB_PASSWORD}"
    working_dir: "/photoprism"
    volumes:
      - "./originals:/photoprism/originals"
      - "./storage:/photoprism/storage"
      - "./import:/photoprism/import"

  mariadb:
    image: mariadb:12.3
    restart: unless-stopped
    stop_grace_period: 15s
    security_opt:
      - seccomp:unconfined
      - apparmor:unconfined
    command: --innodb-buffer-pool-size=512M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
    volumes:
      - "./database:/var/lib/mysql"
    environment:
      MARIADB_AUTO_UPGRADE: "1"
      MARIADB_INITDB_SKIP_TZINFO: "1"
      MARIADB_DATABASE: "photoprism"
      MARIADB_USER: "photoprism"
      MARIADB_PASSWORD: "${DB_PASSWORD}"
      MARIADB_ROOT_PASSWORD: "${DB_ROOT_PASSWORD}"

Important lines:

  • image uses the official image with a fixed version number. The tags are the release date in YYMMDD format, so 261029 is the version from October 29, 2026. You can find the current version in the PhotoPrism release notes.
  • ports binds PhotoPrism only to 127.0.0.1. The port isn’t accessible externally.
  • PHOTOPRISM_ADMIN_PASSWORD is the password for your first sign-in as admin. The official example file uses insecure here. Don’t use that; instead, use a random password from the .env file as shown above.
  • PHOTOPRISM_AUTH_MODE: "password" makes PhotoPrism require a sign-in. Never set this to public on a server connected to the internet, or anyone will be able to view and edit your photos.
  • PHOTOPRISM_SITE_URL is the address where PhotoPrism will be available. Replace photos.example.com with your domain. Shared links use this address.
  • PHOTOPRISM_DISABLE_TLS disables built-in HTTPS because nginx handles encryption.
  • PHOTOPRISM_ORIGINALS_LIMIT and PHOTOPRISM_UPLOAD_LIMIT limit the size of individual files and uploads in MB. PhotoPrism skips larger files, such as long videos.
  • ./originals contains your photos, ./storage contains thumbnails, settings, and backups, and ./database contains the database. Use the ./import folder for the Import feature.

Start PhotoPrism:

Code
docker compose up -d
docker compose logs -f photoprism

On the first start, PhotoPrism creates the database. The app is ready once server: listening on 0.0.0.0:2342 appears. Press Ctrl+C to exit the log view; the containers will keep running.

First Access

Before setting up the reverse proxy, you can test PhotoPrism through an SSH tunnel. Run this on your own computer:

Code
ssh -L 2342:127.0.0.1:2342 root@SERVER_IP

Then open http://localhost:2342 in your browser and sign in with admin and the password shown on the server by running grep ADMIN_PASSWORD ~/photoprism/.env. After that, change the password under Settings > Account > Change Password. The value in the .env file is only for your first sign-in.

Access over HTTPS Through a Reverse Proxy

Set up nginx as a reverse proxy as described in Set Up an nginx Reverse Proxy, and obtain a certificate as explained in SSL Certificate with Let's Encrypt. The server block for PhotoPrism looks like this:

Code
server {
    listen 80;
    server_name photos.example.com;

    client_max_body_size 5000m;

    location / {
        proxy_pass         http://127.0.0.1:2342;
        proxy_set_header   Host $host;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_http_version 1.1;
        proxy_set_header   Upgrade $http_upgrade;
        proxy_set_header   Connection "upgrade";
        proxy_buffering    off;
    }
}
  • client_max_body_size allows large uploads up to the limit set by PHOTOPRISM_UPLOAD_LIMIT. Without this line, nginx stops uploads larger than 1 MB.
  • Upgrade and Connection forward the WebSocket connection PhotoPrism uses to show scan progress and new photos in real time.

Then run sudo nginx -t and sudo systemctl reload nginx, and obtain the certificate with sudo certbot --nginx -d photos.example.com. PhotoPrism is now available at https://photos.example.com.

Back Up Your Data

First, create a current backup of the database and album data. PhotoPrism saves it in the storage/backups folder:

Code
cd ~/photoprism
docker compose exec -T photoprism photoprism backup -i -a -f

Then back up the originals and storage folders, as well as the .env and compose.yaml files—for example, with rsync to another server or storage location. To create a complete copy that includes the database folder, briefly stop the containers:

Code
docker compose stop
sudo tar czf ~/photoprism-backup-$(date +%F).tar.gz database storage .env compose.yaml
docker compose start

For large collections, it’s better to back up the originals separately with rsync rather than re-archive them every time. PhotoPrism also creates a database backup once a day and keeps the last three.

Update PhotoPrism

Create a backup first and read the release notes. Then enter the new tag for image in compose.yaml and run:

Code
cd ~/photoprism
docker compose pull
docker compose up -d
docker image prune -f

When it starts, PhotoPrism automatically updates the database to the new version. MARIADB_AUTO_UPGRADE does the same for MariaDB when you switch database versions. Don’t use a preview image for everyday use; it’s a pre-release version for testing.

Upload and Manage Photos

After you sign in, PhotoPrism opens the photo overview. The sidebar contains albums, videos, people, favorites, the map, calendar, keywords, and folders.

Upload and Scan Photos

There are two convenient ways to get photos onto the server:

  • In your browser: In the sidebar, open Library > Import and click Upload. You can upload individual files or ZIP archives. PhotoPrism will scan them afterward.
  • Via WebDAV: Use WebDAV to mount the folder containing your originals like a network drive on Windows, macOS, or Linux, or in a file app. The address is https://photos.example.com/originals/ (for the One-Click App, use the address in the Access link with /originals/ added at the end). Sign in with admin and your password. PhotoPrism also shows the exact address under Settings > Account > Connect via WebDAV.

PhotoPrism automatically scans files copied via WebDAV after about five minutes. To scan a large number of files, start the scan yourself under Library > Index by clicking Start. The first scan of a large collection can take hours because PhotoPrism creates thumbnails and recognizes subjects and faces for every image.

Info: Images missing from the overview?

PhotoPrism classifies images without camera data, such as screenshots or images downloaded from the internet, as “low quality” and holds them for review. Find them in the sidebar under Search > Review. Select them and click Approve to make them appear in the regular overview.

If you’ve enabled two-factor authentication under Settings > Account > 2-Factor Authentication, WebDAV will no longer work with your regular password. Create a separate app password for WebDAV under Apps and Devices.

Use PhotoPrism on Your Smartphone

PhotoPrism doesn’t have a dedicated app in the app stores. Open your address in your smartphone’s browser and add it to your home screen through the browser menu. PhotoPrism will then open like an app in full-screen mode. Upload photos there just as you would on a computer, using Upload.

To automatically transfer new photos from your phone, use an app that uploads via WebDAV, such as PhotoSync. Enter the WebDAV address ending in /originals/ and your account details as the destination. PhotoPrism will then scan the new images automatically.

Share Albums

Select one or more images in the photo overview and use the selection menu to add them to an album. Share an album via a link using the share icon. Anyone with the link can view and download the album without an account. You can delete links or set an expiration date at any time.

Limitations Without a Membership

  • Administrator accounts only. Additional roles such as user, viewer, or guest are only available with a paid PhotoPrism membership. Without a membership, you can share photos via links instead of creating accounts with limited permissions.
  • No email-based password recovery. You’ll need to reset a forgotten password on the server; see the FAQ.
  • Location details require an online service. To show locations on the map, PhotoPrism looks up GPS coordinates using its own service. Place names won’t appear if the server doesn’t have an internet connection.
  • Processing power. Image recognition and video processing run on the CPU. PhotoPrism doesn’t use a graphics card on a VPS, so scanning large collections takes longer.

Conclusion

PhotoPrism gives you your own photo library with AI-powered search, facial recognition, maps, and link sharing, without handing your pictures over to a cloud provider. To get new photos from your devices onto the server automatically, the guide Set Up Syncthing on a Linux Server shows you how to keep folders in sync between your phone, PC, and server.

If you have any other questions or need help, our support team is available every day! 🙂

Free tools

Related tools for servers and developers

View all

FAQ

Frequently asked questions

The One-Click App is the quickest option: within minutes, PhotoPrism runs over HTTPS on your domain with a MariaDB database, passwords generated by ZapX, and sign-in enabled from the start. Install updates from the dashboard under App Update. The manual Docker Compose installation is a good choice if you don’t use One-Click Apps on your server, want to connect an existing photo folder directly, adjust upload limits, or control the version yourself.
PhotoPrism is great for searching, organizing, and sharing a large existing collection, and it preserves your folder structure. Immich is designed to automatically back up phone photos using its own Android and iOS apps, and supports multiple users by default. If your smartphone is the priority, Immich is usually more convenient; for a photo archive, PhotoPrism is a better fit.
Open PhotoPrism in your smartphone’s browser, add the page to your home screen, and upload photos via Library > Import > Upload. For automatic transfers, use an app with WebDAV uploads, such as PhotoSync, with your installation’s address followed by /originals/ and your PhotoPrism account details. PhotoPrism doesn’t have its own app in the app stores.

Feedback

Was this article helpful?

Your feedback helps us prioritize and improve content.

0 of 0 people found this article helpful.

Personal support

Need more help than the guide provides?

Our ZAP-Hosting support team knows your product — briefly describe your issue and we'll help you personally.

Zappy knows this guide and answers you right in the chat.