Skip to main content

XProtect Evidence Manager

Setting up a multi-tenant environment in XProtect Evidence Manager

Last Updated: 3 minute read
Version2.1
LanguageEnglish

A multi-tenant deployment allows a single XProtect Evidence Manager (XEM) platform instance to host multiple distinct, isolated organizations (tenants). Each tenant operates in complete data and operational isolation, with its own:

  • Dedicated database and user credentials

  • Independent user directories and role permissions

  • Isolated file system document root

  • Distinct domain or subdomain mapping

  • Separate scheduled tasks (cron jobs) and licensing

Throughout this guide, the existing primary instance is referred to as xem (located at /var/www/xem), and the new secondary tenant is referred to as xem2 (located at /var/www/xem2 under the domain xem2.com). Replace xem2 and xem2.com with your tenant's actual identifier and domain name.

Prerequisites

Before configuring a new tenant, ensure you have:

  • XProtect Evidence Manager web 4.6 or later

  • Root or sudo administrative access to the host server.

  • The XProtect Evidence Manager multi-tenant package (xem.tar.gz) and a valid multi-tenant license.

  • DNS records configured pointing your new tenant domain (e.g., xem2.com) to the server IP.

  • An existing XEM primary deployment with Nginx, MySQL/MariaDB, and PHP 8.2-FPM.

Configure Nginx virtual host

Create an independent web server configuration for the new tenant.

  1. Go to the Nginx sites directory:

    cd /etc/nginx/sites-available
  2. Copy the baseline XEM configuration to create the new tenant configuration:

    sudo cp xem xem2
  3. Open the new site configuration in an editor:

    sudo nano xem2
  4. Update the following directives in xem2:

    1. Domain/server name:

      server_name xem2.com;
    2. Document root:

      root /var/www/xem2;
    3. HTTP listener:

      listen 80;
    4. HTTPS redirect (temporary): Comment out or disable until SSL is configured:

      return 301 https://$server_name$request_uri;
    5. SSL certificates: Temporarily comment out or remove existing ssl_certificate, ssl_certificate_key.

  5. Enable the new site by creating a symbolic link to sites-enabled:

    sudo ln -s /etc/nginx/sites-available/xem2 /etc/nginx/sites-enabled/
  6. Verify the Nginx configuration syntax:

    sudo nginx -t

Deploy application files and set permissions

  1. Go to the web server root:

    cd /var/www/
  2. Create the document root directory for the new tenant:

    sudo mkdir xem2
  3. Extract the XEM deployment archive into the tenant directory:

    sudo tar -zxf /path/to/file/xem.tar.gz -C /var/www/xem2/ --keep-directory-symlink --no-same-owner --no-same-permissions

    Replace /path/to/file/xem.tar.gz with the actual path to your package archive.

  4. Configure tenant environment settings:

    sudo nano /var/www/xem2/include/config.php

    Update database name, database user, password, site URL, and tenant-specific values.

  5. Set file ownership to the web server user:

    sudo chown -R www-data:www-data /var/www/xem2

Provision tenant database

Create an isolated database and a dedicated database user for xem2.

  1. Open the MySQL console:

    sudo mysql
  2. Execute the following SQL queries (replace <<password>> with a strong password):

    CREATE DATABASE xem2;
    CREATE USER 'xem2'@'localhost' IDENTIFIED BY '<<password>>';
    GRANT ALL PRIVILEGES ON xem2.* TO 'xem2'@'localhost';
    FLUSH PRIVILEGES;

    Note: Use a unique database name per tenant and avoid using the same database user across all tenants.

  3. Import the default XEM database schema into the new database:

    USE xem2;
    SOURCE /var/www/xem2/sql/xem.sql;
    EXIT;

Install PHP dependencies

  1. Install Composer packages for the new tenant (run as www-data so file permissions stay correct):

    sudo -u www-data composer --working-dir=/var/www/xem2 install
  2. Run the XEM internal composer update script:

    sudo -u www-data php /var/www/xem2/pages/tools/update_composer.php

Configure scheduled tasks (Cron Jobs)

  1. Run required XProtect Evidence Manager cron jobs manually once to confirm that scheduled tasks work before enabling them permanently.

  2. Open the crontab editor for the www-data web user:

    sudo -u www-data crontab -e
  3. Copy the existing cron entries from the main XEM site and update the paths from /var/www/xem to /var/www/xem2.

Enable SSL and apply service changes

  1. Restart Nginx and PHP-FPM:

    sudo systemctl restart nginx php8.2-fpm
  2. Generate and install SSL certificates for the new site.

  3. After the SSL certificate is ready, add ssl_certificate and ssl_certificate_key back into the Nginx config, and enable the HTTPS redirect directive:

    return 301 https://$server_name$request_uri;
  4. Validate and reload Nginx:

    sudo nginx -t && sudo systemctl reload nginx