How to add custom SSL certificate?

We currently use selfsigned certificate but we want to buy SSL certificate but to buy it we need an csr file, how/where do I get it?
Or as a minimum how can we import certificate into nextcloud?

Are certificates being handled thro apache2 or …?
Lots of questions and very little answers on nextcloud manual.

It is something to do in Apache or your Webserver.
Try letscrypt

letsencrypt doest support custom ports so it is not an option sadly
so you are saying that nextcloud uses certificates from apache2?

Yes, it is not a nextcloud thing. It should be done in the siteconfig in Apache2

But you can have it for free from letscrypt…

Letsencrypt has option to verify using DNS, once installed, any port will work.

sudo certbot -d your.domain.tld --manual --preferred-challenges dns certonly

crs (certificate signing request) is generated on server from cli, but you dont need it, when using Letsencrypt’s certbot.

Or:

Its fine, they wanted to order paid certificate, so we did it, now I only got question about thing I found googling:

After generating the SSL certificate /etc/apache2/sites-available/default-ssl.conf needs to have the following entries configured:
SSLCertificateFile /etc/letsencrypt/live/nextcloud.mydomain.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/nextcloud.mydomain.com/privkey.pem
Then:
sudo a2enmod ssl
sudo a2ensite default-ssl.conf
sudo systemctl reload apache2

I understand that here he explains that i need to add my certificate to config but what do those last 3 commands do? are they only for letsencrypt or I need to run them if I add custom certificate?

they activate the moduls you need fo a https or ssl and restart the apache2 afterward.

more here
https://hallard.me/enable-ssl-for-apache-server-in-5-minutes/

ok, thanks