Can nextcloud use self-signed certificates?

I have a local installation of Nextcloud. I want to use https with a self-signed certificate, but it seems not to like that. Is that by design?

what error are you getting?

Failed to connect to Nextcloud at SSL handshake failed.
I already tried to connect via Google Chrome and it offered me a chance to trust the self-signed certificate, which got stored in my Mac’s certificate repository.

Here’s how Firefox sees the site:

this depends more on the webserver/browser configuration than on nextcloud…

The browser configuration?

This could help you to understand this issue :

If I use a self-signed certificate, is it advisable to close port 80?

works fine on my VPS Linux CentOS 7 with cPanel self-signed certificate with NC 16.

It has nothing to do with Nextcloud at all. The certificate is configured with the webserver. But it’s up to the client/browser if self-signed certificates, without public trusted CA, are accepted or not. Nearly all clients show at least a warning. Some browsers allow to explicitly accept a self-signed certificate, either once or by adding to the list of trusted CAs, others deny it without exception.