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

  • Each tenant (domain) is shielded in the certificate, as you're not able to see what other tenants are present

  • If a certificate expires (because of a DNS change from a tenant for example), other tenants are not affected and will continue to work

How to create a tenant?

Creating tenants is rather easy. When you head over to your site in Ploi, go to the Manage tab and press the Tenants button.

Then after that, you can start creating tenants (sites) just like you normally do:

The tenants created here, will always point to the same root of the main site, in this case ploi.io.

08 December 2021 (last updated 1 week ago)

6894 views

Written by Dennis

Dennis brings over 6 years of hands-on experience in server management, specializing in optimizing web services for scalability and security.

Back to Domains


Start free trial