Symptoms
Attempting file uploads on the websites don't compete, or they fail. The Nginx log will show the below similar errors:
Note: The Nginx error log can be located at path: "/var/log/nginx/error.log
".
*494756 client intended to send too large body: 1778270 bytes
Description
Nginx has a limit on the body size by default. If the limit is exceeded, an error will occur log file, and most commonly, it will be observed on the website as a failure to upload the files.
Workaround
The Nginx configuration will need to be modified to allow larger upload sizes. The desired upload size will need to be set with the option: "client_max_body_size
" in the Nginx configuration.
Note: This also assumes that the PHP INI configurations have already been adjusted to include the higher upload/post limits.
The below changes will need to be made in the SSH/Terminal via editing files with a text editor for Linux like vi, vim, or nano. It is strongly recommended to make these changes with an administrator's assistance to prevent issues in the configuration file. Making the wrong change could cause the service to go offline.
1. Edit the "http
" block: ( Will apply settings globally )
Create a new file in the conf.d directory for Nginx.
touch /etc/nginx/conf.d/maxuploadsize.conf
2. Edit the new file: "/etc/nginx/conf.d/maxuploadsize.conf
" to add below syntax to set 500m limit:
client_max_body_size 500m;
3. Restart Nginx and FPM.
/scripts/restartsrv_nginx
/scripts/restartsrv_apache_php_fpm
For more information on customizing Nginx settings, it is best to review the official documentation page.
NGINX with Reverse Proxy - Configuration Files
Comments
0 comments
Article is closed for comments.