Nginx常见报错整理【Nginx服务出现413 Request Entity Too Large的解决办法、HTTP请求:Failed to load resource: the server r】

简介: Nginx常见报错整理【Nginx服务出现413 Request Entity Too Large的解决办法、HTTP请求:Failed to load resource: the server r】

出现问题


1、Nginx服务出现413 Request Entity Too Large的解决办法


原因分析:


查看Nginx 关于client_max_body_size的描述

http服务客户端最大上传默认设置为1M


Syntax: client_max_body_size size;

Default: client_max_body_size 1m;

Context: http, server, location


Sets the maximum allowed size of the client request body, specified in
the “Content-Length” request header field. If the size in a request
exceeds the configured value, the 413 (Request Entity Too Large) error
is returned to the client. Please be aware that browsers cannot
correctly display this error. Setting size to 0 disables checking of
client request body size.


解决办法:


修改nginx.conf配置文件,增加client_max_body_size大小。


http {
  ...
  # set client body size to 50M #
    client_max_body_size 50m;
    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;
    ...
}


2、HTTP请求:Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)


上传文件时出现:请求体过大无法上传



解决方案:设置client_max_body_size 8M


设置位置:


可以选择在http{ }中设置:client_max_body_size 20m;
也可以选择在server{ }中设置:client_max_body_size 20m;
还可以选择在location{ }中设置:client_max_body_size 20m;
三者到区别是:http{} 中控制着所有nginx收到的请求。而报文大小限制设置在server{}中,则控制该server收到的请求报文大小,同理,如果配置在location中,则报文大小限制,只对匹配了location 路由规则的请求生效。


相关文章
|
存储 网络协议 应用服务中间件
Nginx--connection&request
Nginx--connection&request
|
负载均衡 应用服务中间件 nginx
解决nginx配置负载均衡时invalid host in upstream报错
在Windows环境下,配置Nginx 1.11.5进行负载均衡时遇到问题,服务无法启动。错误日志显示“invalid host in upstream”。检查发现上游服务器列表中,192.168.29.128的主机地址无效。负载均衡配置中,两个服务器地址前误加了"http://"。修正方法是删除上游服务器列表和proxy_pass中的"http://"。问题解决后,Nginx服务应能正常启动。
1343 4
解决nginx配置负载均衡时invalid host in upstream报错
|
安全 应用服务中间件 网络安全
修复HTTPS升级后出现 Mixed Content: The page at 'https://xxx' was loaded over HTTPS, but requested an insecure frame 'http://xxx'. This request has been blocked; the content must be served over HTTPS. 的问题
修复HTTPS升级后出现 Mixed Content: The page at 'https://xxx' was loaded over HTTPS, but requested an insecure frame 'http://xxx'. This request has been blocked; the content must be served over HTTPS. 的问题
|
JSON 网络协议 应用服务中间件
Nginx入门 -- 理解Nginx基础概念:请求处理(Request)
Nginx入门 -- 理解Nginx基础概念:请求处理(Request)
428 0
|
小程序
Failed to load local image resource Xx the server responded with a status of of 500 (HTTP/1.1 500)
Failed to load local image resource Xx the server responded with a status of of 500 (HTTP/1.1 500)
1159 4
|
Kubernetes 容器 Perl
k8s部署seata 报错 没有提供足够的身份验证信息 [ http-nio-7091-exec-2] [ty.JwtAuthenticationEntryPoint] [ commence] [] : Responding with unauthorized error. Message - Full authentication is required to access this resource
Kubernetes pod 在16:12时出现两次错误,错误信息显示需要完整认证才能访问资源。尽管有此错误,但页面可正常访问。附有yaml配置文件的图片。
1223 2
|
Python
【Azure 应用服务】Azure Function HTTP Trigger 遇见奇妙的500 Internal Server Error: Failed to forward request to http://169.254.130.x
【Azure 应用服务】Azure Function HTTP Trigger 遇见奇妙的500 Internal Server Error: Failed to forward request to http://169.254.130.x
393 0
|
Java Shell API
【Azure 环境】Update-MgEntitlementManagementAccessPackageAssignmentPolicy 命令执行时候遇见的 No HTTP Resource was found 问题分析
【Azure 环境】Update-MgEntitlementManagementAccessPackageAssignmentPolicy 命令执行时候遇见的 No HTTP Resource was found 问题分析
225 0
Bad Request, Resolved [org.springframework.http.converter.HttpMessageNotReadableException,跟着视频仔细比对
Bad Request, Resolved [org.springframework.http.converter.HttpMessageNotReadableException,跟着视频仔细比对
|
API Java
解决HTTP 400 Bad Request错误的方法
解决HTTP 400 Bad Request错误的方法
12618 0

热门文章

最新文章