Increase upload max size in NextCloud Jail in TrueNas

jayjays401

Cadet
Joined
Sep 27, 2021
Messages
5
Hi all, I just setup my TrueNas system and installed NextCloud plugin. I also installed the App in my iPad and tried auto upload photos and videos. Everything works fine until I found a few files just won’t upload. When I checked the log file, I found the following error for the files which failed:

2021-09-25 17:58:34 Network completed upload file: https://192.168.68.118/remote.php/webdav/Photos/iPad Air 4/20-09-14 11-03-49 0778.mov with error code 413 and error description 413: The file is too large

My OS is as follows:

1632746296555.png


when I go into "System" in NextCloud, PHP shows the following:
1632746378784.png


I think the “Upload max size” being 513mb is definitely the issue. I just need some help to adjust this metric in my TrueNas system.

I have zero background in coding, so I guess the place I need to go is TrueNas Jail → Shell, then the following command line pops up:
1632746508753.png



I don’t know what I need to next … if you could help with the next few lines so I can adjust the upload size limit that would be greatly appreciated! Thanks!

One very silly question, do I need to "Stop" the NextCloud plugin in TrueNas before I make any changes in Jail->Shell then restart the Plugin after changes are made?

Jay
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Probably (depending on your install method), you can use this:
ee /usr/local/etc/php.ini

Then scroll for about an hour until you find the setting you're after and change it, then ESC to exit and select to save... restart the jail.
 

jayjays401

Cadet
Joined
Sep 27, 2021
Messages
5
thanks very much @sretalla! I did exactly that:

1632784264149.png


1632784316016.png


1632784422338.png


1632784493225.png


1632784882830.png


regarding the installation, I installed the Plug-in in TrueNas followed by the prompt. (followed instructions in this video - How to Install NextCloud on TrueNAS 12 CORE - YouTube )

after restarting the Jail, I logged in to the NextCloud web server as admin and PHP screen still shows the same 513 max upload size

1632785223182.png


is there another place I need to adjust the php.ini file? using this install method?

thanks
 

jayjays401

Cadet
Joined
Sep 27, 2021
Messages
5
An update. I did some research on how to navigate the Shell and changed the parameters in the .ini file in the following directory: /usr/local/etc/php/php.truenas.ini

1632806938161.png


restarted the Jail and the NextCloud plugin, the PHP section seems to have been updated with the new info:

1632806958269.png

however, when I tested on my ipad by shooting a video that’s more than 600M and let the NextCloud App auto upload, the 413 error code “The file is too large” still comes up and the video will not upload.

I think the “php.truenas.ini” just contains info for display only and doesn’t actually change the actual limit. unfortunately, I need to dig further. any help would be much appreciated!
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
is there another place I need to adjust the php.ini file?
maybe.

The quickest way to find out would be:

find / -name php.ini

Then you will see all the php.ini files in the jail and you can modify any or all of them.

I guess there may be one in the nextcloud path somewhere, so try that one first.
 

jayjays401

Cadet
Joined
Sep 27, 2021
Messages
5
thanks sretalla, did the search and the only place which has the php.ini file seems to be the /etc

1632813648484.png


the interesting thing is, the php.ini file in this directory was actually created by me from the php.ini-production file in the same directory using the "CP" function. I did it after reading a post online: How to install Nextcloud on FreeNAS in an iocage jail with hardened security - Samuel Dowling

1632813865565.png


when I tried to use the command "nano", the Shell tells me this is not a valid command. so I used "ee". this obviously didn't work.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703

jayjays401

Cadet
Joined
Sep 27, 2021
Messages
5
thanks again. so I tried that and only place I can find it is /usr/local/www/nextcloud/config/config.php. went in there and it's a pretty short doc, nothing in there mentions upload max filesize. I tried to manually add the three lines in the file and save&exit. restarted NextCloud and encountered a "server error" when I tried to get into the NextCloud server. So I had to delete the three lines again, server came back to normal afterwards.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
I guess the next thing to try would be to add a php.ini (copy) in the nextcloud root (/usr/local/www/nextcloud/)... or maybe in the config directory where the config.php is.

And a last option would be to look at the default php.ini location for the webserver (apache or nginx, I guess).
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
php.ini is located in /usr/local/etc on FreeBSD. Did you restart the php-fpm service (or the entire jail) after your changes?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703

ver151set

Dabbler
Joined
Jan 28, 2015
Messages
37
# set max upload size
client_max_body_size 512M;
fastcgi_buffers 64 4K;

/iocage/jails/nextc/root/usr/local/etc/nginx/conf.d/nextcloud.conf

But ive never changed it, Ive uploaded 2GB files with no issues. It must be breaking them up into chunks or something
 

CrownedMartyr

Dabbler
Joined
Nov 20, 2021
Messages
21
I'm just chiming in to report that I'm having the same problem and I'm also pulling out my hair trying to figure out how to raise the upload limit. Any videos I record over 513 MB on my iPhone are failing to transfer to the server with the 413 error code. It's bananas how confusing it is to make such a simple change.

If I find anything, I'll report back. As of today, I am having the exact same issue (and tried the same workarounds) as the OP.
 

CrownedMartyr

Dabbler
Joined
Nov 20, 2021
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:

1638424095114.png


I changed it to this:

1638424100158.png


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.
 

IMNOTA

Cadet
Joined
Jan 2, 2022
Messages
1
CrownedMartyr you're a savior I have been spending the whole evening figuring this out, took me long enough to even understand it was a file size limit and then all I could find where steps to follow when using nextcloud on bare metal which didn't apply to my jail install, but this did it ! Thanks
 

a159873

Cadet
Joined
Jan 11, 2022
Messages
1
Hi Guys, Sorry for reviving and old thread but i have been having issues with the max upload.

I have changed it within the php file but when changing the max upload in the nextcloud.conf but when the jail is restarted the file reverts back to the default value and removed my max size setting.

Has anyone seen this issue?

thanks in advanced for any help, now on the second day of trying to get this sorted.
 

Dovie

Cadet
Joined
Jan 24, 2022
Messages
2
Hi, I was also having this issue.
Specifically when I was trying to upload through Nextcloud WebDav.
Like someone mentioned uploading through the web (and app I'm guessing) uploads it in chunks so it doesn't go over the limit.

@a159873 I also thought it didn't work at first, but I realized that I edited the wrong file.
There are 2 Nextcloud.inc files.
1643068846424.png

I first tried the 2nd one, but it's the first.
Hopefully that helps!
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
I first tried the 2nd one, but it's the first.
Since you're editing that from outside the jail it points out something interesting...

If you ever upgrade that jail, there's every likelihood that your edits to file 1 will be replaced with file 2. I'm not even sure if a restart might also do that.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
If you ever upgrade that jail, there's every likelihood that your edits to file 1 will be replaced with file 2. I'm not even sure if a restart might also do that.
Does the plugin "magically" move/copy configuration files around? I installed Nextcloud in a jail completely manually and my jail never does anything like this. Alle files in the jail are persistent as expected.
What is the reason for the plugin to do this?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Does the plugin "magically" move/copy configuration files around?
I don't know if it's right to say exactly that, but from my observation, when you run iocage upgrade on a plugin jail, it re-runs the install scripts (which I am thinking in this case will copy file 2 over file 1... not sure if I'm right in that exact case, but there it is).
 
Top