Nginx inside Nextcloud plugin config keeps resetting after machine restart

Kosygor

Dabbler
Joined
Sep 28, 2021
Messages
18
Hello I have got bare-metal TrueNAS-12.0-U6 installation with Nextcloud plugin version:
22.1.1_2 release:12.2-RELEASE-p10
I did configuration from this and this article to achieve SSL secured connection.
Everything is fine but when I restart whole machine.
After restart configuration file is reseted to default.
/usr/local/etc/nginx/conf.d/nextcloud.conf”
including
server_name _;
After each restart for SSL to work I have to add
server_name example.com;
and run
certbot --nginx -d exmple.com

Nginx logs are clear there is no sign of dumping configuration file and loading default values.

One way of making around this is to copy backup file every time machine starts, but I feel like I am missing something simple, and there is “right” way for making this..
 

debsahu

Cadet
Joined
Nov 9, 2021
Messages
3
Make changes to nextcloud.conf.template, which I am guessing gets copied to nextcloud.conf after every boot. I did that and it survives a reboot.
 

Kosygor

Dabbler
Joined
Sep 28, 2021
Messages
18
Thank You @debashu. Never noticed this file. This was the right way. After restart nextcloud.conf has proper values.
But ... still after restart I have to do
Code:
certbot --nginx -d example.duckdns.org

to get right SSL certificate. Any idea what I am missing ?
 

Kosygor

Dabbler
Joined
Sep 28, 2021
Messages
18
@CrownedMartyr Thank You for Your support. I will investigate this further after I will switch NC to proxmox LXC.
 

daniel87655

Dabbler
Joined
Jul 19, 2021
Messages
11
i Had the same issue but i worked out what was happening and it seems to work for me.
TrueNAS-12.0-U7
NextcloudV23

when reboot or shut down truenas, nextcloud copies nextcloud.https.conf.template to nextcloud.conf over writing everything to default settings or the nextcloud HTTPS self signed cert.

so nextcloud has to be running normally to work EG cerbot SSL working

// move to directory of conf files
#cd /usr/local/etc/nginx/conf.d

// make sure nextcloud.https.conf.template and nextcloud.conf files are located with command
#ls

// rename nextcloud.https.conf.template so you have a copy if needed later
#mv nextcloud.https.conf.template nextcloud.https.conf.template.original

//copies current working nextcloud.conf to the template file
#cp nextcloud.conf nextcloud.https.conf.template


reboot / restart to check if it worked.

This worked for me let me know how you go
 
Last edited:

Kosygor

Dabbler
Joined
Sep 28, 2021
Messages
18
I have migrated to TrueNAS Scale but thank You for Your reply.
 

verada12

Cadet
Joined
Dec 25, 2018
Messages
8
i Had the same issue but i worked out what was happening and it seems to work for me.
TrueNAS-12.0-U7
NextcloudV23

when reboot or shut down truenas, nextcloud copies nextcloud.https.conf.template to nextcloud.conf over writing everything to default settings or the nextcloud HTTPS self signed cert.

so nextcloud has to be running normally to work EG cerbot SSL working

// move to directory of conf files
#cd /usr/local/etc/nginx/conf.d

// make sure nextcloud.https.conf.template and nextcloud.conf files are located with command
#ls

// rename nextcloud.https.conf.template so you have a copy if needed later
#mv nextcloud.https.conf.template nextcloud.https.conf.template.original

//copies current working nextcloud.conf to the template file
#cp nextcloud.conf nextcloud.https.conf.template


reboot / restart to check if it worked.

This worked for me let me know how you go
Not sure if your experience can help me.
I have installed the Nextcloud plugin on Truenas 8.1 using DHCP
Created DDNS domain through Noip and pointed to my online web address
Port forwarded 80 and 443 towards jail IP via modem
Downloaded and installed Certbot certs using nginx in the NC jail
Nextcloud recognises and applies the Certbot certs
No problems local network access Nextcloud https://Nextcloud jail IP. As expected shows site insecure warning - using Certbot cert
Can ping the domain
Still no remote access
 

verada12

Cadet
Joined
Dec 25, 2018
Messages
8
Not sure if your experience can help me.
I have installed the Nextcloud plugin on Truenas 8.1 using DHCP
Created DDNS domain through Noip and pointed to my online web address
Port forwarded 80 and 443 towards jail IP via modem
Downloaded and installed Certbot certs using nginx in the NC jail
Nextcloud recognises and applies the Certbot certs
No problems local network access Nextcloud https://Nextcloud jail IP. As expected shows site insecure warning - using Certbot cert
Can ping the domain
Still no remote access
Apologies for typo; using Truenas 12.8.1
 
Top