LoginSignup
3
4

More than 5 years have passed since last update.

Nginx 413 Request Entity Too Large

Posted at

Nginxの「413 Request Entity Too Large」のエラー
原因は、Nginxとphp-fpmの「ファイルの扱いの限界を超えている」というエラー

これを直すためには、2ファイル編集します。

  1. /etc/nginx/nginx.confの[client_max_body_size]
  2. /etc/php.ini

1. /etc/nginx/nginx.confの編集

$ vi /etc/nginx/nginx.conf

/etc/nginx/nginx.conf
http {
    ...
    server {
        listen 80;
        server_name example.com;
        root [自分のrootディレクトリデフォルトは/usr/share/nginx/html];
        index index.php index.html;
        client_max_body_size 10m; # ここ重要!
    }
    ...
}

2. /etc/php.iniの編集

いじるphp.iniが環境によって違う可能性もあるので一応確認

いじるファイルの確認

$ php -i | grep php.ini

Loaded Configuration File => /etc/php.ini

こういうの出てきます。

編集

場所は「post_max_size」と「upload_max_filesize」

viならば「/post_max」と「/upload_max」とかで検索かければすぐです。
$ vi /etc/php.ini

/etc/php.ini
...
post_max_size = 10M
...

...
upload_max_filesize = 10M
...

更新

$ sudo systemctl restart nginx
$ sudo systemctl restart php-fpm

これで私は、解決しました!

3
4
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
3
4