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修改文件上传大小限制 的全部内容, 来源链接: utcz.com/z/511143.html

回到顶部