Increase upload max size in NextCloud Jail in TrueNas

cheaptrick666

Explorer
Joined
Feb 9, 2022
Messages
67
Hey guys. I am looking to solve this issue with my NextCloud. How do I edit this client_max_body_size?

I went through Jails->NextCloud->Shell
There I go cat /usr/local/etc./nginx/conf.d/nextcloud.inc

Now the file is open. But what command do I need to change this size limit to something above 512M?

I would be really glad if someone could help.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
It's not "open". You just displayed its content in your terminal session. You should use ssh to login to your jail because the web UI shell is broken. Then you use an editor to change the contents. vi, ee come bundled with FreeBSD. Nano can be installed with pkg install nano inside the jail.
 

cheaptrick666

Explorer
Joined
Feb 9, 2022
Messages
67
You can probably tell that I have very little knowledge of these things. How would I use an ssh to login to my jail? Would I do it directly on my computer without a browser? I wish there was an easy way to change such a simple thing as the maximum upload size.
 

tkoxff

Cadet
Joined
Feb 27, 2022
Messages
1
Well, perhaps I spoke too soon. I may have found a solution but I would love for someone to follow-up behind me and let me know if this is the right approach.

I looked at the file @ver151set mentioned (/usr/local/etc/nginx/conf.d/nextcloud.conf) but I didn't see any existing values for # set max upload size. I did notice that it referenced another file in that same directory: nextcloud.inc. When I checked that file, I found the values I was looking for:
It's working for me too!
It has failed with the files that size about 2GB which uploading from my mac with Nextcloud client.
Finally it's synced successfully even with 504 gateway timeout error.. ha.
 

CPT82

Cadet
Joined
May 6, 2022
Messages
4
Hello,
on the android app version of Nextcloud i receive upload failed message "Request Entity Too Large"
I noted that others have had success in uploading larger files. so....

I edited the nextcloud.inc
within /mnt/jails/iocage/jails/nextcloud/root/usr/local/etc/nginx/conf.d/

modified the line:
client_max_body_size 512M;
to
client_max_body_size 16G;
---------------------------
After that I ran the command 'iocage restart nextcloud'

attempted upload from the app again and still received the error.
on the web version of nextcloud i don't even get a help full message other than "an unknown error occurred"
I vaguely poked around some logs that I found and didn't really see any relevant error(s) that were around the same time when i tried the upload.

So i was wondering if any others made any other changes to any other files within the jail or outside of the jail.
Any help would be awesome and greatly appreciated.
 

CPT82

Cadet
Joined
May 6, 2022
Messages
4
Well... i'm
Hello,
on the android app version of Nextcloud i receive upload failed message "Request Entity Too Large"
I noted that others have had success in uploading larger files. so....

I edited the nextcloud.inc
within /mnt/jails/iocage/jails/nextcloud/root/usr/local/etc/nginx/conf.d/

modified the line:
client_max_body_size 512M;
to
client_max_body_size 16G;
---------------------------
After that I ran the command 'iocage restart nextcloud'

attempted upload from the app again and still received the error.
on the web version of nextcloud i don't even get a help full message other than "an unknown error occurred"
I vaguely poked around some logs that I found and didn't really see any relevant error(s) that were around the same time when i tried the upload.

So i was wondering if any others made any other changes to any other files within the jail or outside of the jail.
Any help would be awesome and greatly appreciated.
Just to follow up I fixed the upload size limitation by fixing a single line in the nginx.conf
make a backup of your file, it wouldn't hurt!

SSH into your machine

run command to see your jail IDs
iocage list

with your jail ID (# is the nginx jail)
jexec # tcsch

when you are in your nginx jail change directory to
cd /usr/local/etc/nginx/

stop your nginx service by running
service nginx onestop

edit the nginx.conf file with the built in editor
ee nginx.conf

scroll down and look for the line "keepalive_timeout 65;" just below it add the following line
client_max_body_size 1024M;
save and exit the editor

restart your nginx service by
service nginx onestart

after you have started your nginx service backup go ahead and attempt to do an upload again.
 

Aviatorpaal

Dabbler
Joined
Mar 2, 2022
Messages
21
Well, perhaps I spoke too soon. I may have found a solution but I would love for someone to follow-up behind me and let me know if this is the right approach.

I looked at the file @ver151set mentioned (/usr/local/etc/nginx/conf.d/nextcloud.conf) but I didn't see any existing values for # set max upload size. I did notice that it referenced another file in that same directory: nextcloud.inc. When I checked that file, I found the values I was looking for:

View attachment 51150

I changed it to this:

View attachment 51151

Instantly, I was able to upload larger files from my iPhone. Unfortunately, this change wasn't reflected in the admin portal, so I manually edited the /usr/local/etc/php/php.truenas.ini to make it match the change to the other file.

I don't like that the value I see reported in the dashboard isn't directly affected by the actual value that controls this, but at least it's working for now. Again, I'd love for someone more knowledgeable than me to explain what's going on here.
I can confirm this worked for me on Truenas Core 13.0 with the "Plugin" version of Nextcloud (newest version, verified with "occ upgrade" inside the jail as of August 9th 2022
 

raidenwow

Cadet
Joined
Aug 9, 2022
Messages
1
I can confirm this worked for me on Truenas Core 13.0 with the "Plugin" version of Nextcloud (newest version, verified with "occ upgrade" inside the jail as of August 9th 2022

I can also confirm this worked


cd /usr/local/etc/nginx/ ee nginx.conf
and /usr/local/etc/php/ ee php.truenas.ini
and /usr/local/etc/nginx/conf.d/ ee nextcloud.inc

all three of these locations I had to change, and the last one, nextcloud.inc fixed it by upping the 512MB to 5000MB (or w/e)
 

golfox2

Dabbler
Joined
Mar 8, 2022
Messages
30
Guys I wish I had found this topic sooner, it solved my 512mb size limit problem too ! I can upload 16gb files now. Thank you sooooooo much !
I summarised the solution here to avoid reading all the thread, might save a few minutes to new comers :

SOLUTION :
In the nextcloud jail's shell, go to the directory :
Code:
cd /usr/local/etc/nginx/conf.d


edit the "nextcloud.conf" file with "vi editor" :
Code:
vi nextcloud.conf


then move to the line client_max_body_size 512M; and thanks to the commands of vi editor (here is documentation) change to 16G; for example. Then press "escape" and then write ":x" to save and quit the editor.

To change the value shown in the "system" tab of the nextcloud web interface, in the nextcloud jail's shell, go to the directory :
Code:
cd /usr/local/etc/php


edit the "php.truenas.ini" file same as above and change the line : "upload_max_filesize=..." to desired value. Then press "escape" and then write ":x" to save and quit the editor.

Finally, restart the whole nextcloud jail.
 

nbp937

Cadet
Joined
Mar 20, 2023
Messages
2
As we say in my country, here's a "new 20": if you are using a proxy jail that has nginx to access the nextcloud's jail, you need to edit the nginx.conf file of the proxy jail too (e.g. as laid out in this tutorial) - it's located in the same place as the comments above specify.
 

golfox2

Dabbler
Joined
Mar 8, 2022
Messages
30
As we say in my country, here's a "new 20": if you are using a proxy jail that has nginx to access the nextcloud's jail, you need to edit the nginx.conf file of the proxy jail too (e.g. as laid out in this tutorial) - it's located in the same place as the comments above specify.
I'll save the video, thanks for that !
 

mk061g

Cadet
Joined
Aug 15, 2023
Messages
1
I can also confirm this worked


cd /usr/local/etc/nginx/ ee nginx.conf
and /usr/local/etc/php/ ee php.truenas.ini
and /usr/local/etc/nginx/conf.d/ ee nextcloud.inc

all three of these locations I had to change, and the last one, nextcloud.inc fixed it by upping the 512MB to 5000MB (or w/e)

Thank you.

This was frustrating to fix but this got it working for me. I honestly don't understand why its so complicated to make this simple change but glad it works now so I can upload videos..
 

Ryle

Dabbler
Joined
Aug 16, 2011
Messages
22
Hello
I have done this modification before, but i had a bad idea to try to update nextcloud that have made me reinstall the complete jail and face again this issue but this time it's more problematic:

I have modified all those places, (and even more, maybe outdated... php.ini-dev/prod) but i still have the issue...
TrueNAS-13.0-U5.3
nextcloud version : 13.1-RELEASE-p9

nginx.conf :

# Common limits
# ----------

client_max_body_size 8g; # upload size
client_body_buffer_size 1m;
client_header_timeout 3m;
client_body_timeout 3m;

php.truenas.ini

PHP:
; recommended value of 512MB for php memory limit (avoid warning when running oc
memory_limit=1G
post_max_size=8G
upload_max_filesize=8G

[B]nextcloud.inc[/B]

# set max upload size
client_max_body_size 8G;



I don't know where I can try other settings...
thanks in advance
 
Top