2

I have a Craft 3 site deployed to a Digital Ocean droplet via Laravel Forge. I have the maxUploadFileSize set to 256B (268435456 in bytes) in my config/general.php like so:

<?php

return [
  // Global settings
  '*' => [
    'omitScriptNameInUrls' => true,
    'securityKey' => getenv('SECURITY_KEY'),
    'maxUploadFileSize'=> 268435456,
    'useProjectConfigFile' => true,
    'defaultSearchTermOptions' => array(
      'subLeft' => true,
      'subRight' => true,
    ),
  ],
  'dev' => [
    'devMode' => true,
    'rememberedUserSessionDuration' => 'P1Y',
    'userSessionDuration' => 'P1Y',
  ],
  'production' => [
    'allowAdminChanges' => false,
  ],
];

When I go to upload a file larger than 8mb I get this error:

The file “.mp3” could not be uploaded, because it exceeds the maximum upload size of 8.0 MB.

My php.ini has upload_max_filesize set to 256M. I can't figure out what exactly is blocking uploads. Nothing in my .env file or my nginx.conf appears to be hindering the upload size.

Any help you can provide would be greatly appreciated!

1
  • I did confirm that my client_max_body_size is set to 256M in my nginx.conf file in Laravel Forge. Commented Aug 16, 2019 at 18:06

2 Answers 2

3

After doing some digging, this article helped solve my issue: https://stackoverflow.com/questions/36582004/increase-upload-max-filesize-via-forge.

By increasing the post_max_size in the PHP FPM Configuration and the PHP CLI Configuration I was able to resolve the issue and increase my upload limit to 256M.

1
  • Just a comment on this - using both this answer and Andrew's answer below it worked for me, but not until I restarted both PHP and nginx.
    – CreateSean
    Commented Nov 14, 2019 at 15:47
3

Check out nginx-craft specifically:

https://github.com/nystudio107/nginx-craft/blob/master/forge-example/NginxConfiguration.conf#L25

    # Disable limits on the maximum allowed size of the client request body
    client_max_body_size 0;

Setting client_max_body_size to 0 will set it to "no limit" so you can control any limit you like in one place, the Craft CMS general.php config file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.