nginx上传文件提示413 Request Entity Too Large错误
最近切换到nginx服务器,发现上传文件是提示“413 Request Entity Too Large”错误。解决方式:
在 nginx 下的配置文件 nginx.conf
在老wu的ubuntu系统下的路径为:sudo vim /etc/nginx/nginx.conf
在 http{} 项下添加配置:client_max_body_size 512m; 这里老wu设置为512M
[php] user nginx;worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
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 /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
client_max_body_size 512m;
include /etc/nginx/conf.d/*.conf;
}
最后重启一下nginx服务
sudo service nginx restart