nginx 修改文件上传大小限制

修改nginx的配置文件,添加client_max_body_size 字段

注:client_max_body_size 必须要放在server下的server_name下,而不是放在location字段下面

 

server {
    listen       80;
    server_name  www.abc.com;

    add_header Access-Control-Allow-Origin *;
    add_header Access-Control-Allow-Credentials true;
    add_header Access-Control-Allow-Headers *;
    add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
	
    client_max_body_size 10M;

    location / {
        proxy_set_header   Host $host;
        proxy_set_header   X-Real-IP $remote_addr;
        proxy_set_header   X-Request-ID $global_request_id;
        proxy_set_header   X-Forwarded-Proto $scheme;
        proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;
        proxy_pass http://192.168.1.1:8080;
    }
}

 

  

 

你可能感兴趣的:(nginx 修改文件上传大小限制)