I have a nginx server with a php-fpm backend.
On the nginx server, I have a client_max_body_size
limiting the upload of anything.
So I decide to disable post_max_size
and upload_max_size
? They are already limited by the nginx server anyway… And this would avoid duplicate limitation and configuration.
To do that, I did try to set them
post_max_size = 0
upload_max_filesize = 0
which seem to do the job, while partially documented.
Is this setup safe?
2
Answers
This response is not (yet) factual.
Since the NGINX limit the upload size, the limit is de facto applied to any communication to the PHP. The limit in the PHP is thus not necessary.
But this point is based on the fact that NGINX is doing the job correctly.
The documentation of
post_max_size
says in the Changelog:so the correct value is
0
, not-1
. The changelog for 5.3.4 says that this doesn’t work when the content type isapplication/x-www-form-urlencoded
. But since you have to usemultipart/form-data
to upload files, this isn’t relevant when you want to allow large file uploads.The documentation of
upload_max_size
doesn’t say how to make it unlimited, but it seems likely that it would be the same. It should be simple to verify this expectation, and you could submit a bug report to fix the documentation.