nginx返回413 Request Entity Too Large

03-21

413 Request Entity Too Large说明php上传文件或者Post内容大小超出限制

  1. 修改php配置 upload_max_filesize, post_max_size, 怕超时的话还需要修改max_execution_time

  2. 修改nginx配置 client_max_body_size(默认1M);

demo:

php.ini

upload_max_filesize = 8M
post_max_size = 8M

nginx.conf

server {
    server_name xxx.com;
    listen 80;
    index index.html index.htm index.php;
    root your_web_root;
    client_max_body_size 8M;
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }
    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        include fastcgi.conf;
    }
}