解决
nginx上传文件大小受到限制,需要调整nginx配置。nginx修改上传文件大小限制client_max_body_size 1000M;
nginx修改上传文件大小限制,举例如下:
server {
listen 80;
server_name localhost;
client_max_body_size 1000M;
location /web {
alias D:/web;
index main.html;
}
location /web/service {
proxy_pass http://HOST/service;
}
location /web/service/upload {
proxy_pass http://HOST/upload;
}
}
附加
显示真实IP配置
worker_processes 1;
error_log stderr notice;
events {
worker_connections 1024;
}
http {
include mime.types;
variables_hash_max_size 1024;
access_log off;
#real_ip_header X-Real-IP;
charset utf-8;
gzip on;
gzip_min_length 4k;
gzip_comp_level 5;
gzip_buffers 4 16k;
gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php application/javascript application/json;
gzip_vary on;
client_max_body_size 30M;
# 开发环境
server {
listen 2040;
location / {
#add_header 'Referrer-Policy' 'no-referrer-when-downgrade';
proxy_set_header X-Real-IP $remote_addr; # 存放用户的真实ip
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # 每经过一个反向代理,就会把反向代理IP存放在X-Forwarded-For里
proxy_set_header Host $host;
proxy_pass http://localhost:17050;
}
location ~/api/form {
proxy_set_header Host $host;
proxy_pass http://localhost:17022;
}
location ~/api/ {
#proxy_set_header Host $host;
proxy_pass http://localhost:17042;
}
}
}