13

Error: 413 Request Entity Too Large

I have attempted to increase upload_max_filesize to 20M using the Edit PHP FPM Configuration and Edit PHP CLI Configuration tools in Laravel Forge. It successfully saves my settings, but the changes don't seem to take affect. I have tried restarting nginx and the server.

Environment:

  • AWS EC2
  • nginx
Donnie
  • 6,229
  • 8
  • 35
  • 53

3 Answers3

18

As @dave-alvarez mentioned, there is a setting in Laravel Forge to do this.

  • Select your server & choose PHP from the left menu.
  • Set Max File Upload Size as a megabyte integer (with no trailing unit).
  • Confirm your change by going to the bottom of the page & clicking the Files pull-up, Edit PHP FPM Configuration option. You can search the php.ini for upload_max_filesize.

enter image description here

enter image description here

LordParsley
  • 3,808
  • 2
  • 30
  • 41
17

I was missing a piece. Here's the whole answer.

Nginx Configuration

Add the following line to http or server or location context to increase the size limit in nginx.conf:

# set client body size to 20M #
client_max_body_size 20M;

PHP Configuration

Edit php.ini and set the following directives:

;This sets the maximum amount of memory in bytes that a script is allowed to allocate
memory_limit = 256M

;The maximum size of an uploaded file.
upload_max_filesize = 20M

;Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize
post_max_size = 30M

Source: http://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/

Donnie
  • 6,229
  • 8
  • 35
  • 53
17

Updating since this is the first search engine result for a search on this topic:

Forge now has a built-in setting you can update by going to the server details page and then clicking on PHP from the menu on the left. You'll see a form to change the max file size.

Dave Alvarez
  • 619
  • 6
  • 7