当前位置:网站首页>【bug】上传图片出现错误(413 Request Entity Too Large)
【bug】上传图片出现错误(413 Request Entity Too Large)
2022-06-27 17:58:00 【掘金者说】
解决
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;
}
}
}
边栏推荐
猜你喜欢

External interrupt experiment based on stm32f103zet6 library function

Blink SQL内置函数大全

Error reported by Huada MCU Keil_ Weak's solution

MySQL表的增删改查(基础)

一种朴素的消失点计算方法

The Fifth Discipline: the art and practice of learning organization

指针和结构体

308. 二维区域和检索 - 可变 线段树/哈希

华大单片机KEIL报错_WEAK的解决方案

DCC888 :Register Allocation
随机推荐
One to one relationship
UE4-Actor基础知识
【登录界面】
什么是SSR/SSG/ISR?如何在AWS上托管它们?
1030 Travel Plan
云笔记到底哪家强 -- 教你搭建自己的网盘服务器
binder hwbinder vndbinder
labelimg使用指南
shell脚本常用命令(三)
Determine whether a variable is an array or an object?
嵌入式软件开发中必备软件工具
实战回忆录:从Webshell开始突破边界
经纬度分析
Leetcode 821. 字符的最短距离(简单) - 续集
聊聊毕业季
1025 PAT Ranking
从感知机到前馈神经网络的数学推导
Blink SQL内置函数大全
Leetcode 989. 数组形式的整数加法(简单)
如何封裝調用一個庫