# Nextcloud Sub Domain

**URL:** https://dietpi.com/forum/t/nextcloud-sub-domain/5219
**Category:** General Discussion
**Created:** [15 April 2021 13:10 UTC](https://dietpi.com/forum/t/nextcloud-sub-domain/5219 "2021-04-15T13:10:40Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![Burgess85](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@Burgess85](https://dietpi.com/forum/u/Burgess85)
#### Post date: [15 April 2021 13:10 UTC](https://dietpi.com/forum/t/nextcloud-sub-domain/5219/1 "2021-04-15T13:10:40Z")

</div>

Currently have nextcloud installed at [example.com/nextcloud](http://example.com/nextcloud) does anyone know how to install at [cloud.example.com](http://cloud.example.com)

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [15 April 2021 21:49 UTC](https://dietpi.com/forum/t/nextcloud-sub-domain/5219/2 "2021-04-15T21:49:21Z")

</div>

Hi,

would be good if you can share the web server used

MichaIng  
I recall a longer discussion with a user on GitHub about a similar setup. Maybe you can have a look.

---

<div class="post-metadata">

### Author: ![MichaIng](https://dietpi.com/forum/user_avatar/dietpi.com/michaing/32/7_2.png) [@MichaIng](https://dietpi.com/forum/u/MichaIng)
#### Post date: [16 April 2021 17:05 UTC](https://dietpi.com/forum/t/nextcloud-sub-domain/5219/3 "2021-04-16T17:05:06Z")

</div>

Puhh, ja I remember one case where I instructed a user how to do it and one year later during another web application install he ran into a then expected error and it took quite a while to remember that special setup and fix things. Note that there is not really any reason why a subdomain would be better to split applications compared to sub directories. For security reasons (to marke scraping a little harder), sub directories are actually better and easier to handle regarding HTTPS certificates and webserver-side settings/hardenings in general. Sub domains make sense when you use different physical servers which run different applications for the same domain/organisation, otherwise they will make things more complicated.

There are multiple ways to achieve it, via proxy, via rewrites or by changing the webroot, and the Nextcloud config needs to be altered. It depends hence whether Nextcloud is and will always be the same web application/website on that system or if you plan to add other ones, now or in the future.

---

<div class="post-metadata">

### Author: ![Totila](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/t/cc9497/32.png) [@Totila](https://dietpi.com/forum/u/Totila)
#### Post date: [21 May 2023 04:52 UTC](https://dietpi.com/forum/t/nextcloud-sub-domain/5219/4 "2023-05-21T04:52:14Z")

</div>

Just reviving this thread to get a little insights in the best way to turn a dietpi subfolder installation into a subdomain one (using nginx).

Where would I need to look?

I found this

> [@Nextcloud problems / questions](https://dietpi.com/forum/t/nextcloud-problems-questions/15415/78):
>
> I don’t think you need to do all this development. There should be no need to create own files. Basically, it is quite simple. adjust /etc/nginx/sites-available/default and change root /var/www into root /var/www/nextcloud adjust /etc/nginx/sites-available/default and remove small block for location / adjust /etc/nginx/sites-dietpi/dietpi-dav\_redirect.conf and remove sub path /nextcloud from all configs adjust /etc/nginx/sites-dietpi/dietpi-nextcloud.conf and remove sub path /nextcloud from …

This works for nextcloud.

But: after I applied the changes, I can no longer open the pihole admin page under internalIP/admin.

Thanks in advance l.  
T

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [21 May 2023 07:50 UTC](https://dietpi.com/forum/t/nextcloud-sub-domain/5219/5 "2023-05-21T07:50:41Z")

</div>

> [@Totila](#):
>
> But: after I applied the changes, I can no longer open the pihole admin page under internalIP/admin.

This is correct and expected because you have customised the web server document root and therefore the PiHole admin page can no longer be found.

---

<div class="post-metadata">

### Author: ![Totila](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/t/cc9497/32.png) [@Totila](https://dietpi.com/forum/u/Totila)
#### Post date: [21 May 2023 09:04 UTC](https://dietpi.com/forum/t/nextcloud-sub-domain/5219/6 "2023-05-21T09:04:36Z")

</div>

Can this expected behaviour be resolved by changing the nginx configuration?

---

<div class="post-metadata">

### Author: ![Jappe](https://dietpi.com/forum/user_avatar/dietpi.com/jappe/32/1788_2.png) [@Jappe](https://dietpi.com/forum/u/Jappe)
#### Post date: [21 May 2023 10:11 UTC](https://dietpi.com/forum/t/nextcloud-sub-domain/5219/7 "2023-05-21T10:11:36Z")

</div>

Your webroot was `/var/www`, inside there was `/pihole`, `/admin` and `/nextcloud`. Your root is now `/nextcloud`, you are not able to reach the “sibling” folders. just revert you changes and you are able to reach it again.  
Btw why use a subdomain? It works with a subfolder just fine ootb and the config for subdomain is not so trivial.

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [21 May 2023 10:33 UTC](https://dietpi.com/forum/t/nextcloud-sub-domain/5219/8 "2023-05-21T10:33:47Z")

</div>

> [@Totila](#):
>
> Can this expected behaviour be resolved by changing the nginx configuration?

You would need to use Nginx Server Blocks (Virtual Hosts) to have different configuration for different domains. Following gives an idea on how it could looks like [How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 16.04 | DigitalOcean](https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04)

---

<div class="post-metadata">

### Author: ![Totila](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/t/cc9497/32.png) [@Totila](https://dietpi.com/forum/u/Totila)
#### Post date: [21 May 2023 11:49 UTC](https://dietpi.com/forum/t/nextcloud-sub-domain/5219/9 "2023-05-21T11:49:25Z")

</div>

Thanks for the pointer @Joulinar

Not too confident knowing my abilities, but I will give it a try.

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [22 May 2023 09:38 UTC](https://dietpi.com/forum/t/nextcloud-sub-domain/5219/10 "2023-05-22T09:38:28Z")

</div>

as stated by @MichaIng above [Nextcloud Sub Domain - #3 by MichaIng](https://dietpi.com/forum/t/nextcloud-sub-domain/5219/3)  
There is no real need for setting up a sub domain. It will just complicate thinks compare to sub path.

---

<div class="post-metadata">

### Author: ![Totila](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/t/cc9497/32.png) [@Totila](https://dietpi.com/forum/u/Totila)
#### Post date: [22 May 2023 10:31 UTC](https://dietpi.com/forum/t/nextcloud-sub-domain/5219/11 "2023-05-22T10:31:50Z")

</div>

Ask my wife who asked me to make things consistent for every service hosted at home. 😉

All good, nginx server blocks allowed me to do what I was told to want.

Pihole still accessible, nextcloud and others on a subdomain.

---

<div class="post-metadata">

### Author: ![Phanthomgraph](https://dietpi.com/forum/user_avatar/dietpi.com/phanthomgraph/32/4439_2.png) [@Phanthomgraph](https://dietpi.com/forum/u/Phanthomgraph)
#### Post date: [3 August 2023 21:06 UTC](https://dietpi.com/forum/t/nextcloud-sub-domain/5219/12 "2023-08-03T21:06:33Z")

</div>

Another bump for this article. I would like to run various web sites/apps on DietPi using nginx, each of them being reachable under their own domain name. I want to tie each domain with their own web root, by using various virtual host/server block files. I don’t want to use the default set-up of subfolders under a single web root.

Reading the documentation and forum posts, it’s unclear to me how the scripts used with DietPi may interfere with such a virtual host set-up. So, once the virtual host to tie the webroot to that appropriate (sub)domain has been set up, will I run into issues during an update, a reinstall of the app, letsencrypt renewal, etc?
