Using existing TLS certificate with nginx

Hi,

I’m trying to setup https on nextcloud using nginx with a certificate provided by tailscale.

However, I’m unable to get it to run. My current config seems to make nginx crash

services.nginx.virtualHosts.${config.services.nextcloud.hostName} = {
  forceSSL = true;
  sslCertificate = "/var/lib/tailscale/certs/domain.cert";
  sslCertificateKey = "/var/lib/tailscale/certs/domain.key";
};

services.tailscale.enable = true;

services.nextcloud = {
  enable = true;
  https = true;
  hostName = "domain";
  config.adminpassFile = "/etc/nextcloud-admin-pass";
};

I can’t seem to find relevant information as every nixos wiki about ssl seems to use enableACME.

Do you know what is wrong in my config ?

This error was raised because nginx didn’t have permissions to read the certs.

chown nginx:nginx worked