Help us understand the problem. What is going on with this article?

[WordPress on nginx + GCP ] 413 Request Entity Too Largeの対処法

413 Request Entity Too Largeの対処法

環境

Google Cloud Platform (GCP)
WordPress with NGINX and SSL Certified by Bitnami

問題

ワードプレステーマファイル(zip)をインストールしようとしたところ、413 Request Entity Too Large というエラー。

413.PNG

対処法

TODO 1: nginx.confにて、アップロード容量を決める1行(client_max_body_size)を追加

例えば、client_max_body_size 50m だと50MB
※nginx.confはデフォルトだとここにあります。=> /opt/bitnami/nginx/conf

nginx.conf
http {
   ...
   client_max_body_size 50m; 
   ...
}

TODO 2: php.iniにて、upload_max_filesizepost_max_sizeを修正

例えば以下だと、50MB
 upload_max_filesize = 50M
 post_max_size = 50M

※php.iniはデフォルトだとここにあります。=> /opt/bitnami/php/etc/php.ini
参考: もういい加減覚えよう。php.iniはどこにあるのか

php.ini
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 50M
php.ini
; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size = 50M

TODO 3: 最後にnginxをリスタート

sudo nginx -s reload

以上です!再度テンプレートファイル(zip)をアップロードしてみてください。

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away