Matomo Analytics

Consider the tenants feature as domain aliases on steroids. They are almost the same as domain aliases where you have:

server_name domain.com anotherdomain.com example.com

You will have a full NGINX config per tenant included in the original main domain, that looks like this:

include /etc/nginx/ploi/domain.com/tenants/*;


server {
    listen 80;
    listen [::]:80;


    root /home/ploi/domain.com/public;
    server_name anotherdomain.com;


    include /etc/nginx/ssl/anotherdomain.com;


    index index.php index.html;


    charset utf-8;


    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }


    access_log off;
    error_log  /var/log/nginx/anotherdomain.com-error.log error;


    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }


    error_page 404 /index.php;


    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php8.0-fpm.sock;
        fastcgi_buffers 16 16k;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }


    location ~ /\.(?!well-known).* {
        deny all;
    }
}

In the above case, you have the main domain called domain.com and the tenant anotherdomain.com.

As you can see, the tenant itself is a complete NGINX configuration on its own offering a few extra possibilities:

  • Each tenant has the ability to get its own custom NGINX configuration more easily
  • Each tenant has its own certificate, and you will not reach the 100 domains per certificate limit in Let's Encrypt

The tenants feature is currently only available in our API: https://developers.ploi.io/tenants/list-tenants

08 December 2021 (last updated 5 months ago)

552 views

Back to Domains