Still getting 413 Request Entity Too Large even after client_max_body_size 100M

前端 未结 1 842
借酒劲吻你
借酒劲吻你 2021-02-20 11:08

I\'m using Rails and Nginx on Digital ocean and I\'ve been trying to upload a 17.6 MB file and I\'m still getting 413 Request Entity Too Large even after setting

相关标签:
1条回答
  • 2021-02-20 11:29

    Okay. I figured this out. Following the Digital Ocean guide for how to configure nginx, I was setting client_max_body_size 100M in the file /etc/nginx/nginx.conf. And for sure, changing things there definitely had impact on what the server did. Especially when I would mess something up in that file and the server stopped functioning.

    However, I had forgotten that in Deploying a Rails App on Ubuntu 14.04 with Capistrano, Nginx, and Puma which was my main resource for setting up my server, it shows that these parameters get set up not in the above nginx.conf but rather in my rails app there is the file ~/my_app/config/nginx.conf in which the setup parameters already included the statement

      client_max_body_size 10M;
    

    So I changed that statement as well as in the /etc/nginx/nginx.conf file on production. Voila! Now I can upload files up to 100M.

    0 讨论(0)
提交回复
热议问题