nginx 413 Request Entity Too Large 错误解决方法
2017-06-30 tech nginx 3 mins 1117 字
今天在网站上传文件时,出现这个错误
413 Request Entity Too Large
解决办法是打开nginx主配置文件nginx.conf,找到http{}段,修改或者添加下面的字段
client_max_body_size 30m;
然后重启nginx
./reload.sh
顺便贴一下我的 nginx.conf 配置文件的 http 设置。
http {
access_log off;
log_format default_format '$time_iso8601|$remote_addr|$request_method|$status|$request_length|$request_time|$http_referer|$http_user_agent|$request_uri';
fastcgi_cache_path /var/local/nginx/fastcgi_cache/one_hour keys_zone=fastcgi_1h:16m levels=1:2 inactive=1h max_size=1g;
limit_conn_zone $binary_remote_addr zone=conn_perip:16m;
limit_req_zone $binary_remote_addr zone=req_perip:16m rate=2r/s;
limit_rate_after 2048k;
limit_rate 512k;
client_header_timeout 8s;
client_body_timeout 8s;
client_max_body_size 32m;
server_names_hash_bucket_size 64;
gzip on;
gzip_min_length 16384;
gzip_types text/javascript text/css text/xml text/plain application/json application/x-javascript application/xml;
include mime.types;
sendfile on;
keepalive_timeout 30 30;
upstream services {
server localhost:8090;
keepalive 16;
}
include vhost/*.conf;
}