Did you just receive the error “413: Request Entity Too Large” on WordPress instance?
This is my brief guide to let you know what it means and how to resolve the issue.
My setup is using WordPress by Bitnami hosted on the Google Cloud Platform, but it should work on any WordPress set up that you have hosted on your own servers.
Why have you just received the error: “413: Request Entity Too Large” on WordPress?
Main reason: Your nginx web server has a limit on uploads by default, so you need to increase the default limits.
In more detail, it indicates that your web server configured to restrict large file size. Your nginx web server can be set to allow the maximum size of the client request body using client_max_body_size directive.
If the size of a request exceeds the configured value, the 413 (Request Entity Too Large) error message returned.
As these are the defaults for an ngnix server:
I received this when I was recently migrating a backup of WordPress onto a new instance/ set up of WordPress. So the file sizes we were looking at were bigger than the default settings in place.
So naturally, we just need to increase these limits.
How do you manage the “413: Request Entity Too Large” error?
This is for a Nginx web server configuration, to fix this issue edit your nginx.conf.
To do so on Google Cloud Platform:
Step 1 – Login to the remote server using SSH client
Step 2 – Open the ngnix.conf file to edit using a text editor
You will want to open and edit your ngnix config file using a text editor. I am using nano editor to edit this:
$ sudo nano /etc/nginx/nginx-app.conf
You can also use vi editor or vim editor, using the word “vi” or “vim” instead of “nano”, such as the following:
$ sudo vi /etc/nginx/nginx-app.conf $ sudo vim /etc/nginx/nginx-app.conf
If you’re using Bitnami WordPress, this file is stored at: /opt/bitnami/apps/wordpress/conf/nginx-app.conf
Type the following command to edit your nginx.conf using a text editor:
You’re looking for the client_max_body_size parameter of the ngnix configuration (more information at https://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size). By default, that’s set to 1MB so, in order to change that, edit your configuration file.
$ sudo nano /opt/bitnami/apps/wordpress/conf/nginx-app.conf
Add the following line to http or server or location context to increase the size limit in nginx.conf, enter:
$ client_max_body_size 8M;
Then press: Control + O to “Write Out” (save the changes), which will tell the server to save the settings.
Step 3- Reload the nginx webserver
Restart your ngnix web server:
$ sudo /opt/bitnami/ctlscript.sh restart nginx (if needed) $ sudo /opt/bitnami/ctlscript.sh start nginx
You should receive and see something like this:
/opt/bitnami/nginx/scripts/ctl.sh : Nginx stopped
/opt/bitnami/nginx/scripts/ctl.sh : Nginx started
Then you can confirm that your ngnix web server is back up and running here with:
$ sudo /opt/bitnami/ctlscript.sh status
Nginx already running
php-fpm already running
mysql already running
STEP 4- Upload the file again
Try uploading the file again that gave you the “413: request entity too large” error. You should no longer see the error messaeg.
Hopefully that helps you to get this working this time round!