413 Request Entity Too Large

413 Request Entity Too Large

Q : How to fix this problem if i get error : 413 Request Entity Too Large ?

A : You need to configure both nginx and php.ini to allow upload size.

On nginx configuration

The client_max_body_size directive assigns the maximum accepted body size of client request, indicated by the line Content-Length in the header of request. To fix this issue edit your nginx.conf

[root@sg11b ~]# nano /etc/nginx/nginx.conf

Add or change the following line to http or server or location context to increase the size limit

client_max_body_size 6M;

Save and close the file and then restart the nginx service

[root@sg11b ~]# systemctl restart nginx.service

 

On php.ini

Your php installation also put limits on upload file size. Edit php.ini and set the following directives

[root@sg11b ~]# nano /etc/php.ini

; Whether to allow HTTP file uploads.
file_uploads = On

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 6M

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20

Save and close the file and then restart the nginx service

[root@sg11b ~]# systemctl restart nginx.service

 

Done

Add a Comment