1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

413 Request Entity Too Large がしつこかった

Last updated at Posted at 2022-06-22

Amazon Linux2 + nginx上でアプリを作っています。
クライアントに画像をアップロードさせる際、エラー
413 Request Entity Too Large
が返されました。
調べるとnginxではデフォルトで1Mバイトの大きさのファイルしかアップロードできず、nginx.confを変更してやることで解決できるとありました。

↓これを追記する

client_max_body_size 500M;       #500Mは好きな数字に。0 で無制限

ただ、言われた通り設定して再起動しても通らないので、おかしいなと思ったところ、記入する場所が複数ありました。

まず設定ファイルの場所を確認します。
sudo nginx -t
おそらく
/etc/nginx/nginx.confが出てくるでしょう。この中で、
http, server, location
の3箇所に、client_max_body_sizeを設定でき、
少なくともこのうち http と server で記入しなければいけないようです。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?