Search code examples
phpsecuritynginxupload

In php-fpm with nginx, can I disable upload_max_filesize?


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?


Solution

  • 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.