Step by Step Instructions to set up NextCloud and Nginx official Apps for Newbies

caitken

Dabbler
Joined
Dec 6, 2023
Messages
13
It took me (and a few others) many long hours to successfully set up the official NextCloud and Nginx reverse proxy managers on TrueNAS Scale - so I thought I'd post these instructions here in the hope that other TrueNAS Scale noobs like me might find them useful.

Prerequisites:
- A registered domain name
- SSL Origin certificate - I used Cloudflare free
- SSD Pool
- HDD Pool
- Migrate the TrueNAS Scale 'Apps Service' to the SSD Pool (go to Apps and select 'Choose Pool' select the SSD Pool and it will copy across an existing ix-applications dataset to the new Pool)

Setup Nginx:
- Create an Nginx dataset plus data and certs child datasets on the SSD Pool [Note: Ngnix will only sucessfully install on a SSD - not HDD]
- Select and install the app to the SSD using the datasets
- Reconfigure your router to port forward posts 443, and 8443 to <your TrueNAS Scale server ip here>:30022 and forward port 80 to <your TNS server ip here>:30021
- Access Ngnix from the Web Portal
- Upload Cloudflare Origin cert and key files to teh Certifcates tab on Nginx
- Create two new Proxy Hosts under the Hosts tab as folows:
>> TrueNAS, Domain Name = truenas.<your domain>, Scheme = https, Forward Host = <your TNS ip here> Forward Port = 443
>> NextCloud Domain Name = nextcloud.<your domain>, Scheme = http, Forward Host = <your TNS ip> Forward Port = 9001
- Add the Certificate to both Hosts
- If you use Cloudflare you will need to create an Access List which lists all the Cloudflare ip addresses - hit Add about 30 times, copy all the ip addresses and THEN hit save.

Setup NextCloud:
- Create a NextCloud dataset on HDD (or SDD if you have sufficient space and deep pockets)
- Create the following child datasets: Data, Db, DbBackUp
- Set the permissions on Data to www-data for user and group - and apply recursively.
- Select and install the NextCloud app as follows:
>> Select 'No Certifcate' [Note: the field needs to be empty if you have NextCloud behind a reverse proxy]
>> enable the host paths - Data, Db and DbBackup connecting to relevant dataset previously set up.
>> install ffmpeg and SMB
>> add Enviromental Variable OVERWRITEPROTOCOL = https
>> enable Cron Jobs
- Once the app has installed and is Running (you may have to refresh the screen for it to show correctly)
- Stop the app
- Change the permissions on Data dataset to your user credentials, access the NextCloud SMB and find the Data/Configuration/Config.php file and open it.
- Find the 'Trused Domains' section in the file and add your domain (e.g., example.net) and save
- Change the permissions on Data back to www-data
- Restart the NextCloud app and wait till it is fully up and running (again it may be necessry to refesh the screen)
- Go to the Nginx Webportal and double click on the nextcloud.<your domain name> in the Proxy Host list - this should take you to the NextCloud login screen using the nextcloud.<your domain> url and not the local network ip address
- Login as admin - change the password and add your users

Hopefully these steps will help you avoid some of pitfalls and 'got ya's that I encountered. Probably not everything here is absolutely neccessary - the aim was to be able to install the app without havng to hit the CLI.The only departure from this is the edit of the config.php file to add the Trusted Domain. It would great if this was made an Environmental Variable in future releases to avoid the need to edit config.php directly.

Enjoy!
 

WoisWoi

Dabbler
Joined
Nov 20, 2023
Messages
32
It took me (and a few others) many long hours to successfully set up the official NextCloud and Nginx reverse proxy managers on TrueNAS Scale - so I thought I'd post these instructions here in the hope that other TrueNAS Scale noobs like me might find them useful.

Prerequisites:
- A registered domain name
- SSL Origin certificate - I used Cloudflare free
- SSD Pool
- HDD Pool
- Migrate the TrueNAS Scale 'Apps Service' to the SSD Pool (go to Apps and select 'Choose Pool' select the SSD Pool and it will copy across an existing ix-applications dataset to the new Pool)

Setup Nginx:
- Create an Nginx dataset plus data and certs child datasets on the SSD Pool [Note: Ngnix will only sucessfully install on a SSD - not HDD]
- Select and install the app to the SSD using the datasets
- Reconfigure your router to port forward posts 443, and 8443 to <your TrueNAS Scale server ip here>:30022 and forward port 80 to <your TNS server ip here>:30021
- Access Ngnix from the Web Portal
- Upload Cloudflare Origin cert and key files to teh Certifcates tab on Nginx
- Create two new Proxy Hosts under the Hosts tab as folows:
>> TrueNAS, Domain Name = truenas.<your domain>, Scheme = https, Forward Host = <your TNS ip here> Forward Port = 443
>> NextCloud Domain Name = nextcloud.<your domain>, Scheme = http, Forward Host = <your TNS ip> Forward Port = 9001
- Add the Certificate to both Hosts
- If you use Cloudflare you will need to create an Access List which lists all the Cloudflare ip addresses - hit Add about 30 times, copy all the ip addresses and THEN hit save.

Setup NextCloud:
- Create a NextCloud dataset on HDD (or SDD if you have sufficient space and deep pockets)
- Create the following child datasets: Data, Db, DbBackUp
- Set the permissions on Data to www-data for user and group - and apply recursively.
- Select and install the NextCloud app as follows:
>> Select 'No Certifcate' [Note: the field needs to be empty if you have NextCloud behind a reverse proxy]
>> enable the host paths - Data, Db and DbBackup connecting to relevant dataset previously set up.
>> install ffmpeg and SMB
>> add Enviromental Variable OVERWRITEPROTOCOL = https
>> enable Cron Jobs
- Once the app has installed and is Running (you may have to refresh the screen for it to show correctly)
- Stop the app
- Change the permissions on Data dataset to your user credentials, access the NextCloud SMB and find the Data/Configuration/Config.php file and open it.
- Find the 'Trused Domains' section in the file and add your domain (e.g., example.net) and save
- Change the permissions on Data back to www-data
- Restart the NextCloud app and wait till it is fully up and running (again it may be necessry to refesh the screen)
- Go to the Nginx Webportal and double click on the nextcloud.<your domain name> in the Proxy Host list - this should take you to the NextCloud login screen using the nextcloud.<your domain> url and not the local network ip address
- Login as admin - change the password and add your users

Hopefully these steps will help you avoid some of pitfalls and 'got ya's that I encountered. Probably not everything here is absolutely neccessary - the aim was to be able to install the app without havng to hit the CLI.The only departure from this is the edit of the config.php file to add the Trusted Domain. It would great if this was made an Environmental Variable in future releases to avoid the need to edit config.php directly.

Enjoy!
Hi !

Thanks a lot, your post helped me to solve my problem !

Yet, it is not entirely solved : https://www.truenas.com/community/threads/cant-use-my-domain-name-with-nextcloud.115769/#post-802613
The Nextcloud Windows app isn't working, do you have or did you have this problem ?
1705404167661.png
 

rajesh1136

Cadet
Joined
Mar 15, 2024
Messages
2
i did exact steps and thankfully its working but for some reason nextcloud is not loading the dashboard after the loggin. i need to refresh it to get the dashboard. this is okay in the browser but in the ios app, after loggin it just spins and i cant refresh so not able to login to the mobile app.

any tips ?
 

outlaw009

Cadet
Joined
Mar 24, 2024
Messages
1
Hello,

I followed the instructions as per the guide, I am capable of accessing my turenas instance remotely but not my nextclound instance. If anyone has got this working would yall mind to share screenshots of your configuration files?
 

dquercus

Dabbler
Joined
Dec 31, 2020
Messages
13
It took me (and a few others) many long hours to successfully set up the official NextCloud and Nginx reverse proxy managers on TrueNAS Scale - so I thought I'd post these instructions here in the hope that other TrueNAS Scale noobs like me might find them useful.

Prerequisites:
- A registered domain name
- SSL Origin certificate - I used Cloudflare free
- SSD Pool
- HDD Pool
- Migrate the TrueNAS Scale 'Apps Service' to the SSD Pool (go to Apps and select 'Choose Pool' select the SSD Pool and it will copy across an existing ix-applications dataset to the new Pool)

Setup Nginx:
- Create an Nginx dataset plus data and certs child datasets on the SSD Pool [Note: Ngnix will only sucessfully install on a SSD - not HDD]
- Select and install the app to the SSD using the datasets
- Reconfigure your router to port forward posts 443, and 8443 to <your TrueNAS Scale server ip here>:30022 and forward port 80 to <your TNS server ip here>:30021
- Access Ngnix from the Web Portal
- Upload Cloudflare Origin cert and key files to teh Certifcates tab on Nginx
- Create two new Proxy Hosts under the Hosts tab as folows:
>> TrueNAS, Domain Name = truenas.<your domain>, Scheme = https, Forward Host = <your TNS ip here> Forward Port = 443
>> NextCloud Domain Name = nextcloud.<your domain>, Scheme = http, Forward Host = <your TNS ip> Forward Port = 9001
- Add the Certificate to both Hosts
- If you use Cloudflare you will need to create an Access List which lists all the Cloudflare ip addresses - hit Add about 30 times, copy all the ip addresses and THEN hit save.

Setup NextCloud:
- Create a NextCloud dataset on HDD (or SDD if you have sufficient space and deep pockets)
- Create the following child datasets: Data, Db, DbBackUp
- Set the permissions on Data to www-data for user and group - and apply recursively.
- Select and install the NextCloud app as follows:
>> Select 'No Certifcate' [Note: the field needs to be empty if you have NextCloud behind a reverse proxy]
>> enable the host paths - Data, Db and DbBackup connecting to relevant dataset previously set up.
>> install ffmpeg and SMB
>> add Enviromental Variable OVERWRITEPROTOCOL = https
>> enable Cron Jobs
- Once the app has installed and is Running (you may have to refresh the screen for it to show correctly)
- Stop the app
- Change the permissions on Data dataset to your user credentials, access the NextCloud SMB and find the Data/Configuration/Config.php file and open it.
- Find the 'Trused Domains' section in the file and add your domain (e.g., example.net) and save
- Change the permissions on Data back to www-data
- Restart the NextCloud app and wait till it is fully up and running (again it may be necessry to refesh the screen)
- Go to the Nginx Webportal and double click on the nextcloud.<your domain name> in the Proxy Host list - this should take you to the NextCloud login screen using the nextcloud.<your domain> url and not the local network ip address
- Login as admin - change the password and add your users

Hopefully these steps will help you avoid some of pitfalls and 'got ya's that I encountered. Probably not everything here is absolutely neccessary - the aim was to be able to install the app without havng to hit the CLI.The only departure from this is the edit of the config.php file to add the Trusted Domain. It would great if this was made an Environmental Variable in future releases to avoid the need to edit config.php directly.

Enjoy!

Thanks for the tip :)

Concerning the SMB part to edit config.php, you can also use the occ command. For that, get a console inside the container either via TrueNas Scale UI or with heavyscript and then:

Code:
su -l www-data -s /bin/bash
cd /var/www/html/
php occ db:add-missing-indices (or any other attribute you want to change)
 
Top