Question

500 error in Video Upload

I can’t upload video files to my digital ocean ubuntu server. all other file uploads, images, audio and even pdf go through, i get 500 internal server error. I have tried it locally with postman and it works. I have a 4 GB Memory / 2 Intel vCPUs / 80 GB Disk / LON1 - Ubuntu 22.10 x64 droplet. I am also using Nginx to handle http requests. Even tried a video of 1mb and it still didn’t work.


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.

Hi there,

What I usually suggest in such cases is to follow this guide here on how to troubleshoot common Nginx errors:

https://www.digitalocean.com/community/tutorials/how-to-troubleshoot-common-nginx-errors

And mainly these steps here:

  1. Start by checking the Nginx Error Log:

    • Nginx Error log: Usually located at /var/log/nginx/error.log. You can use the tail -100 /var/log/nginx/error.log command to check the last 100 lines of the log.
    • Also check your application Error log: This depends on the stack you’re using (Node.js, PHP, etc.). If you’re using a framework like Django, Flask, Express, etc., they typically provide their own logging. Check their documentation on how to access the logs.
  2. Check File Size Limits:

    • Nginx by default has a client_max_body_size setting which defines the maximum allowed size for client requests. If the video file exceeds this size, Nginx will respond with a 413 Request Entity Too Large error, but it’s good to double-check this setting. Even if you tried with a 1MB video, let’s confirm:
      • Open the Nginx config: sudo nano /etc/nginx/nginx.conf
      • Look for client_max_body_size. If it’s not present, add it inside the http block:
http {
    ...
    client_max_body_size 100M;
    ...
}

Restart Nginx: sudo systemctl restart nginx

  1. Check File Type Handling:

    • Some applications or servers have security measures to filter file types. Ensure your server-side code doesn’t have any restrictions specifically for video files.
  2. Check Server Resource Usage:

    • Check if your server has enough resources available. Uploading and processing videos can be resource-intensive. Use commands like top, htop, or free -m to see memory usage. If your server is running out of memory, you may need to optimize your application or consider resizing your droplet.
  3. If you are using PHP, the upload_max_filesize and post_max_size in php.ini can also restrict the size of files you’re allowed to upload.

Feel free to share any of the logs here if you wish!

Let me know how it goes!

Best,

Bobby

KFSys
Site Moderator
Site Moderator badge
September 20, 2023

Heya,

A 500 Internal Server Error indicates a problem on the server side. Since you mentioned that you’re able to upload other file types, and the video file upload works locally, it sounds like there’s a configuration or permission issue specific to your server or its environment.

How are you trying to upload your video?

Additionally, have you checked your error logs, if not, please do so.

cat /var/log/nginx/error.log

If you let me know what the error is I can help with that.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel