413 Request Entity Too Large

前端 未结 3 1256
半阙折子戏
半阙折子戏 2020-12-14 17:10

I use nginX/1.6 and laravel when i posted data to server i get this error 413 Request Entity Too Large. i tried many solutions as bellow

1- set client_max_bo         


        
相关标签:
3条回答
  • 2020-12-14 17:54

    I had the same issue but in docker. when I faced this issue, added client_max_body_size 120M; to my Nginx server configuration,

    nginx default configuration file path is /etc/nginx/conf.d/default.conf

    server {
        client_max_body_size 120M;
        ...
    

    it resizes max body size to 120 megabytes.

    after that, I did add these three lines to my PHP docker file

    RUN echo "max_file_uploads=100" >> /usr/local/etc/php/conf.d/docker-php-ext-max_file_uploads.ini
    RUN echo "post_max_size=120M" >> /usr/local/etc/php/conf.d/docker-php-ext-post_max_size.ini
    RUN echo "upload_max_filesize=120M" >> /usr/local/etc/php/conf.d/docker-php-ext-upload_max_filesize.ini
    

    since docker PHP image automatically includes all setting files from the path (/usr/local/etc/php/conf.d/) into php.ini file, PHP configuration file will change by these three lines and the issue must disappear

    0 讨论(0)
  • 2020-12-14 18:04

    Add ‘client_max_body_size xxM’ inside the http section in /etc/nginx/nginx.conf, where xx is the size (in megabytes) that you want to allow.

    http {
          client_max_body_size 20M;         
    }
    
    0 讨论(0)
  • I am using Docker and PHP 7.4 and I faced this issue too.

    Just added a line to the file *.conf inside docker/php74/ directory.

    server {
        client_max_body_size 100M;
        ...
    }
    
    0 讨论(0)
提交回复
热议问题