kakallatt's avatar

413 Request Entity Too Large

I upload a video file (Duration: 25', Size: 243.3MB)

I edited in /etc/nginx/nginx.conf like that:

client_max_body_size 480000M;

And, I also edited in /etc/php5/fpm/php.ini like that:

max_execution_time = 480000
upload_max_filesize = 240000M
post_max_size = 480000M
memory_limit = 240000M```

But I always get the error: 413 Request Entity Too Large

Please help me. Thank you very much !!!
                    
                    
                    
                    
                    
                    
0 likes
7 replies
tykus's avatar

Those numbers are very large! Did you remember to reload?

service php5-fpm reload

service nginx reload

1 like
kakallatt's avatar

Yes, I did but I still got 413 request entity too large.

bashy's avatar

What is in your /etc/nginx/nginx.conf file? You need to do it in each server {} block for it to work.

1 like
kakallatt's avatar

Here is my file:

user vagrant;
worker_processes auto;
pid /run/nginx.pid;

events {
        worker_connections 768;
        # multi_accept on;
}

http {
        server {
                client_max_body_size 480000M;
        }

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;

        server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # SSL Settings
        ##

        ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        ##
        # Logging Settings

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log;

        ##
        # Gzip Settings
        ##

        gzip on;
        gzip_disable "msie6";

        # gzip_vary on;
        # gzip_proxied any;
        # gzip_comp_level 6;
        # gzip_buffers 16 8k;
        # gzip_http_version 1.1;
        # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}


#mail {
#       # See sample authentication script at:
#       # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
#       # auth_http localhost/auth.php;
#       # pop3_capabilities "TOP" "USER";
#       # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
#       server {
#               listen     localhost:110;
#               protocol   pop3;
#               proxy      on;
#       }
#
#       server {
#               listen     localhost:143;
                protocol   imap;
#               proxy      on;
#       }
#}
fideloper's avatar

According to docs on (client_max_body_size](http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size), it can go in http, server, or location blocks - you likely won't need to nest it in a server{ ... } block like that.

Setting it to 0 should disable the check altogether:

client_max_body_size 0;

Finally, run the following to see if there are errors in configuration - perhaps it's just not reloading since there's a config error, thus keeping old settings (restarting I believe would fail to start back up, but if you've only tried reload, that's a possible explanation).

# See if there are any errors
sudo service nginx configtest

# Any errors would be reported in the error log
# so we'll check the last 50 lines of the Nginx error log:
sudo tail -n 50 -f /var/log/nginx/error.log
1 like
kakallatt's avatar

So this is my file:

http {
        client_max_body_size 0;
    .....
}

And there are no errors when I run sudo service nginx configtest:

* Testing nginx configuration [ OK ]

Error log

2016/01/21 16:45:48 [notice] 2635#0: signal process started
2016/01/21 16:45:48 [notice] 2682#0: signal process started
2016/01/21 16:45:49 [notice] 2729#0: signal process started
2016/01/21 16:45:49 [notice] 2776#0: signal process started
2016/01/24 00:04:33 [notice] 3513#0: signal process started
2016/01/24 00:05:32 [notice] 3654#0: signal process started
2016/01/24 00:05:32 [notice] 3701#0: signal process started
2016/01/24 00:05:32 [notice] 3748#0: signal process started
2016/01/24 00:05:33 [notice] 3795#0: signal process started
2016/01/24 00:05:33 [notice] 3842#0: signal process started
2016/01/24 00:05:33 [notice] 3889#0: signal process started
2016/01/24 00:05:34 [notice] 3936#0: signal process started
2016/01/24 00:05:34 [notice] 3983#0: signal process started
2016/01/24 00:05:34 [notice] 4030#0: signal process started
2016/01/24 00:05:35 [notice] 4077#0: signal process started
2016/01/24 00:05:35 [notice] 4124#0: signal process started
2016/01/24 00:05:35 [notice] 4171#0: signal process started
2016/01/24 00:05:36 [notice] 4218#0: signal process started
2016/01/24 00:05:36 [notice] 4265#0: signal process started
2016/01/24 00:05:36 [notice] 4312#0: signal process started
2016/01/24 00:05:37 [notice] 4359#0: signal process started
2016/01/24 00:05:37 [notice] 4406#0: signal process started
2016/01/24 00:05:37 [notice] 4453#0: signal process started
2016/01/24 00:05:38 [notice] 4500#0: signal process started
2016/01/24 00:05:38 [notice] 4547#0: signal process started
2016/01/24 00:05:38 [notice] 4594#0: signal process started
2016/01/24 00:05:39 [notice] 4641#0: signal process started
2016/01/24 00:05:39 [notice] 4688#0: signal process started
2016/01/24 00:05:39 [notice] 4735#0: signal process started
2016/01/24 00:05:40 [notice] 4782#0: signal process started
2016/01/24 00:05:40 [notice] 4829#0: signal process started
2016/01/24 00:05:40 [notice] 4876#0: signal process started
2016/01/24 00:05:41 [notice] 4923#0: signal process started
2016/01/24 00:05:41 [notice] 4970#0: signal process started
2016/01/24 00:05:41 [notice] 5017#0: signal process started
2016/01/24 00:05:42 [notice] 5064#0: signal process started
2016/01/24 00:05:42 [notice] 5111#0: signal process started
2016/01/24 00:05:42 [notice] 5158#0: signal process started
2016/01/24 00:05:43 [notice] 5205#0: signal process started
2016/01/24 00:05:43 [notice] 5253#0: signal process started
2016/01/24 00:13:41 [notice] 5432#0: signal process started
2016/01/24 00:18:28 [notice] 5511#0: signal process started
2016/01/24 00:31:29 [notice] 1661#0: signal process started
2016/01/24 00:40:07 [notice] 1743#0: signal process started
2016/01/24 00:40:49 [notice] 1776#0: signal process started
2016/01/24 00:43:26 [notice] 1816#0: signal process started
2016/01/24 06:03:11 [notice] 1619#0: signal process started
2016/01/24 17:02:51 [notice] 1746#0: signal process started
2016/01/25 05:57:05 [notice] 1667#0: signal process started
2016/01/25 05:58:44 [notice] 1731#0: signal process started

Please or to participate in this conversation.