Using my own domain, how can I setup a subdomain for NextCloud?


I have Nextcloud running on a VM. I setted up everything including the SSL. Now what I want to do is having something like instead of

You’re going to need to set up the SSL certificate for the subdomain, create a CNAME record in your domain registrar’s panel to forward to your server, and then set up Nextcloud to listen for that subdomain.

Should be about it.


Could you elaborate a bit on the “set up NExtcloud to listen for that subdomain” part? What does that really mean? What values have to go into which config files?


You need to set up a virtual host. It’s easy with apache, which web server are you using?

I’m using Apache 2 and I have set up a virtual host, but NextCloud gives me “Internal server error” on login if I try to access it through the subdomain. Pls see this post, where I give all the details:


The script included in the VM will take care of everything for you. The only thing you need to do is to setup the CNAME record and open port 80 and 443 in your router, then run the script.

Btw, it’s not recommended to run Nextcloud on the root domain, please always use a subdomain.

When I check my own configuration, I have several subdomains that are configured as virtual hosts in apache. This already works fine, but when I look into my DNS configuration, there is only one CNAME entry for www, not for the other subdomains. Still it works. Why don’t I need CNAME entries for the other subdomains?