Hello Everybody,
I am currently trying to set up a Nextcloud for personal use on my raspberry pi 4 4gb.
I have no experience with any admin-work and this is the first raspi project of mine.
Anyhow dietpi seems to be a good option to run a nextcloud in slim and efficient way.
Since you can install it as optimised software everything seems pretty straight forward.
Since i want to reach the nextcloud from outside over a dedicated Domain i would link to reach the nextcloud directly over the Domain itself an not in a subdir.
So over "my.example.org" rather than "my.example.org/nextcloud".
Checking the nextcloud admin manual i realised that the nginx config files a not exactly how written in the admin manual and i cannot figure out what i have to change.
Where do i need to make changes to get rid of the "/nextcloud"
Thank you in advance,
Jannik
Installing Nextcloud in the webroot of Nginx
Re: Installing Nextcloud in the webroot of Nginx
Hi,
many thanks for your question. If a simple redirect is okay just create an index.php into webroot /var/www with the following content
It just redirects the browser to the nextcloud folder, simple and easy.
many thanks for your question. If a simple redirect is okay just create an index.php into webroot /var/www with the following content
Code: Select all
<?php
header("Location: nextcloud");
?>
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Re: Installing Nextcloud in the webroot of Nginx
Hello,
Thank you for your reply and help!
This would be a solution! I already had it working this way but then came back to trying via changing the configuration of the webserver as I also want to understand more how it works and achieve a clean solution. (not really time efficient i know
)
Since the admin manual of nextcloud already mentions two different set ups for Nginx(one to run nextcloud in a subdir, and one to run in in the webroot). I thought it might not be complicated to change the configuration:
https://docs.nextcloud.com/server/stabl ... nginx.html
But no config file in /etc/nginx matched the code shown in the admin manual, only parts of it.
Could you run me through the different points that need to be changed or would you argue that this would be way to advanced for someone without experience.
If its easier with using apache as webserver this would also be an option for me.
This is also about learning for me so any tips are well appreciated!
Greetz Jannik
Thank you for your reply and help!
This would be a solution! I already had it working this way but then came back to trying via changing the configuration of the webserver as I also want to understand more how it works and achieve a clean solution. (not really time efficient i know

Since the admin manual of nextcloud already mentions two different set ups for Nginx(one to run nextcloud in a subdir, and one to run in in the webroot). I thought it might not be complicated to change the configuration:
https://docs.nextcloud.com/server/stabl ... nginx.html
But no config file in /etc/nginx matched the code shown in the admin manual, only parts of it.
Could you run me through the different points that need to be changed or would you argue that this would be way to advanced for someone without experience.
If its easier with using apache as webserver this would also be an option for me.
This is also about learning for me so any tips are well appreciated!
Greetz Jannik
Re: Installing Nextcloud in the webroot of Nginx
yes indeed, on DietPi thinks are split into a couple of configurations files to be flexible. Because the web server can be used for quite a lot of other web applications as well. Therefore /etc/nginx/nginx.conf is looking quite different than the one from NectCloud docs.
Let me try to explain the setup
Another option would be to change document root directory on /etc/nginx/sites-available/default. However I'm not sure if there are any side effects. Probably @MichaIng knows. At least you will loss possibilities to use the web server for something else.
Let me try to explain the setup
- /etc/nginx/nginx.conf: just a base config that is going to include other config file
Code: Select all
include /etc/nginx/conf.d/*.conf; include /etc/nginx/sites-enabled/*;
- /etc/nginx/sites-enabled: this folder contains all configs that are activated. All files on this directory are linked to /etc/nginx/sites-available/
- /etc/nginx/sites-available/default: defines the web server port and include DietPi specific config files
Code: Select all
include /etc/nginx/sites-dietpi/*.conf;
- /etc/nginx/sites-dietpi: there you will find the NextCloud config file dietpi-nextcloud.conf
- /etc/nginx/sites-dietpi/dietpi-nextcloud.conf: there you have all NextCloud related configurations. Well some hardening and optization.
Another option would be to change document root directory on /etc/nginx/sites-available/default. However I'm not sure if there are any side effects. Probably @MichaIng knows. At least you will loss possibilities to use the web server for something else.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
Re: Installing Nextcloud in the webroot of Nginx
When changing the servers document root, you need to edit /var/www/nextcloud/config/config.php
On 'overwrite.cli.url' remove the trailing /nextcloud from the URL.
On 'overwrite.cli.url' remove the trailing /nextcloud from the URL.