Nginx Error 413

前端 未结 3 1191
迷失自我
迷失自我 2021-02-04 06:11

When I try to upload a file to my site, I\'m getting the Nginx \"413 Request Entity Too Large\" error, however in my nginx.conf file I\'ve already explicitly stated the max size

3条回答
  •  长发绾君心
    2021-02-04 06:58

    My setup was:

    php.ini

    ...
    upload_max_filesize = 8M
    ...
    

    nginx.conf

    ...
    client_max_body_size 8m;
    ...
    

    The nginx showed the error 413 when it was uploaded.

    Then I had an idea: I will not let nginx show the error 413, client_max_body_size set to a value greater than upload_max_filesize, thus:

    php.ini

    ...
    upload_max_filesize = 8M
    ...
    

    nginx.conf

    ...
    client_max_body_size 80m;
    ...
    

    What happened?

    When you upload smaller than 80MB nginx will not display the error 413, but PHP will display the error if the file is up to 8MB.

    This solved my problem, but if someone upload a file larger than 80MB error 413 happens, nginx rule.

提交回复
热议问题