How to switch from http to https?

You can test in config/config.php with your subdomain:

'overwrite.cli.url' => 'https://cloud.server.tld',
'overwriteprotocol' => 'https',

Of course you need a SSL virtual web server on port 443 and a corresponding SSL certificate.

Then above must be ok. But it is a risk to use Nextcloud on a webspace without shell access.