# HTTPS dashboards (Certbot SANs on meshkee-dashboards)

server {
    listen 443 ssl;
    server_name manage.meshkee.com;
    ssl_certificate     /etc/letsencrypt/live/meshkee-dashboards/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/meshkee-dashboards/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;

    location / {
        root /var/www/meshkee/super-admin;
        try_files $uri $uri/ /index.html;
    }
}

server {
    listen 443 ssl;
    server_name ~^business\.(?<apex>.+)$;
    ssl_certificate     /etc/letsencrypt/live/meshkee-dashboards/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/meshkee-dashboards/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;

    location / {
        root /var/www/meshkee/business;
        try_files $uri $uri/ /index.html;
    }
}

server {
    listen 443 ssl;
    server_name ~^customer\.(?<apex>.+)$;
    ssl_certificate     /etc/letsencrypt/live/meshkee-dashboards/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/meshkee-dashboards/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;

    location / {
        root /var/www/meshkee/customer;
        try_files $uri $uri/ /index.html;
    }
}

server {
    listen 80;
    server_name manage.meshkee.com;
    location /.well-known/acme-challenge/ { root /var/www/certbot; }
    location / { return 301 https://$host$request_uri; }
}

server {
    listen 80;
    server_name ~^business\.(?<apex>.+)$;
    location /.well-known/acme-challenge/ { root /var/www/certbot; }
    location / { return 301 https://$host$request_uri; }
}

server {
    listen 80;
    server_name ~^customer\.(?<apex>.+)$;
    location /.well-known/acme-challenge/ { root /var/www/certbot; }
    location / { return 301 https://$host$request_uri; }
}
