Request Entity Too Large when uploading image to media library on Strapi

I deployed strapi to digital ocean using the one-click guide ( Everything works fine, but when i try to upload an image to the media library i always get the message (Request Entity Too Large).

I tried:

  • Going to plugins and upload with no success since there is no such plugin available with that name (the only ones are CONTENT MANAGER, CONTENT TYPE BUILDER, EMAIL, MEDIA LIBRARY, ROLES & PERMISSIONS.

  • Going to the console and trying to change strapi configs, but i cant access with sudo since all the passwords i try are incorrect (i used all of them, none work)

I am now clueless of what i am suposed to do.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I just ran into this issue myself. It turns out that it is actually NGINX causing this issue, rather than strapi.

This can be verified by opening the networking tab in the browser dev tools, then triggering the error. The request status should be 413. Click on the failing request then select the ‘Response’ tab. It should be an NGINX error page including “413 Request Entity Too Large” and “nginx/1.14.2” (your version number may differ).

I see you are having problems with sudo. What user are you SSHing into the droplet as? I believe the digital ocean default is root. If you SSH in as root, you do not need to use sudo. sudo is used to give root powers to non-root users. So if you are root, just omit the sudo part of the command.

Once I confirmed NGINX to be the culprit, I found this serverfault post with the answer. To summarize the relevant parts of that post and expand a bit (all commands should be run as root):

  1. edit /etc/nginx/nginx.conf on the server: nano /etc/nginx/nginx.conf
  2. Find client_max_body_size in the http block or add it if it doesn’t exist. I picked 20MB as max: client_max_body_size 20M;
  3. Validate the config file syntax: nginx -t
  4. Restart nginx: systemctl restart nginx
  5. Verify that nginx restarted correctly: systemctl status nginx (look for “Active: active(running)” in the output)

This resolved the error for me. Let me know if that works for you, or if you need me clarify anything. Best of luck!