上传文件出现问题 413 Request Entity Too Large,如下图所示
我们可以看到请求的body的大小,在Content-Length后显示,Nginx默认的request body为1M,小于我们上传的大小
解决方案
找到自己主机的nginx.conf配置文件,打开
在http{}中加入 client_max_body_size 120m;
然后重启nginx
/etc/init.d/nginx restart
user ec2-user ec2-user;
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
client_max_body_size 120m;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log logs/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
include /usr/local/nginx/conf/conf.d/*.conf;
}