[Fixed] Nginx Error – 413 Request Entity Too Large

If you are trying to upload a file to your server and get Nginx Error – 413 Request Entity Too Large, so we hope this article can help you fix.


nginx-error-413-request-entity-too-large

Today when we are uploading database to our VPS then we got a message that “Nginx Error – 413 Request Entity Too Large“. To fix this error you just need to increase the size limit in nginx.conf.

  1. You can find nginx.conf file in /etc/nginx/nginx.conf or /usr/local/nginx/conf/nginx.conf
  2. In case you did not find nginx file you can use this command to search: find / -name “nginx.conf”
  3. To edit this file you can connect Use SSH in PuTTY or connect via FTP
  4. After open nginx.conf file, add this command: client_max_body_size 100M (Note: you can change 100M to the size you want).

Your file may look like this:

[code]
user nginx;
worker_processes auto;
worker_rlimit_nofile 69836;

http {
include /etc/nginx/mime.types;
log_format main ‘$remote_addr – $remote_user [$time_local] “$request” ‘
‘$status $body_bytes_sent “$http_referer” ‘
‘”$http_user_agent” “$http_x_forwarded_for”‘;

access_log off;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
types_hash_max_size 2048;
server_tokens off;
server_names_hash_bucket_size 128;
open_file_cache max=50000 inactive=30s;
open_file_cache_valid 60s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
client_body_buffer_size 256k;
client_body_timeout 12;
client_header_buffer_size 2m;
large_client_header_buffers 4 256k;
client_max_body_size 200m;
client_header_timeout 2m;
keepalive_timeout 22;
keepalive_requests 200;
keepalive_disable msie6;
reset_timedout_connection on;
send_timeout 6;
gzip on;
gzip_static on;
gzip_disable “msie6”;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 3;
gzip_buffers 16 8k;
gzip_min_length 1024;
gzip_http_version 1.1;
include /etc/nginx/conf.d/*.conf;
}

[/code]

– Now connect to your VPS via SSH and type this command to restart nginx: service nginx restart

It is working for my case so if you have any problem, you can add a comment to let we know.

Leave a Reply

50% off over 500 items. Grow your toolkit for all projects. Design, build, produce.Cyber Monday