1. 文件大小超越限制
错误信息:413 RequestEntitiTooLarge
相关配置:
client_max_body_s
Syntax:client_max_body_size size;Default:
client_max_body_siz 1m;
Context:http, server, location
Setthemaximumallowsizeoftheclientrequestbody,specifiintheContent-Lengthrequestheaderfield.Ifthesizeinarequestexcetheconfigurvalue,the413RequestEntitiTooLargerrorisreturntotheclient.Pleasbeawarthatbrowsercannotcorrectlidisplaithierror.Setting size to0disablcheckofclientrequestbodisize.
翻译:设置客户端请求正文的最大允许大小,Content-Length 请求头部字段中指定。如果请求中的大小超越配置的值,则向客户端返回 413 请求实体太大 ) 过失。请注意,浏览器无法正确显示此错误。将 SIZE 设置为 0 将禁用客户端请求正文大小检查。
出处:http://nginx.org/en/docs/http/ngx_http_core_module.html#client_max_body_size
2. 连接超时
错误信息:504 GatewaiTime-out
相关配置:
proxy_read_timeout
Syntax:proxy_read_timeout time;Default:
proxy_read_timeout60s;
Context:http, server, location
Definatimeoutforreadaresponsfromtheproxiserver.Thetimeoutissetonlibetweentwosuccessreadoperations,notforthetransmissofthewholeresponse.Iftheproxiserverdoenottransmitanythwithinthitime,theconnectisclosed.
翻译:定义从代理服务器读取响应的超时时间超时仅在两个连续的读取操作之间设置,而不是针对整个响应的传输。如果代理服务器在此时间内没有传输任何内容,则连接将关闭。
出处:http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_read_timeout
注意:一般的请求超时多数都是后端代码业务处理耗时较长导致,故修改这个配置较多,搞不定再修改下面三个配置
fastcgi_connect_timeout
Syntax:fastcgi_connect_timeout time;Default:
fastcgi_connect_timeout60s;
Context:http, server, location
DefinatimeoutforestablishaconnectwithaFastCGIserver.Itshouldbenotethatthitimeoutcannotusualexce75seconds.
翻译:定义与 FastCGI 服务器建立连接的超时时间。应该注意,此超时通常不能超越 75 秒。
出处:http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_connect_timeout
fastcgi_send_timeout
Syntax:fastcgi_send_timeout time;Default:
fastcgi_send_timeout60s;
Context:http, server, location
SetatimeoutfortransmitarequesttotheFastCGIserver.Thetimeoutissetonlibetweentwosuccesswriteoperations,notforthetransmissofthewholerequest.IftheFastCGIserverdoenotreceivanythwithinthitime,theconnectisclosed.
翻译:设置向 FastCGI 服务器传输请求的超时时间。超时仅在两个连续的写入操作之间设置,而不是针对整个请求的传输。如果 FastCGI 服务器在此时间内未收到任何内容,则连接将关闭。
出处:http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_send_timeout
fastcgi_read_timeout
Syntax:fastcgi_read_timeout time;Default:
fastcgi_read_timeout60s;
Context:http, server, location
DefinatimeoutforreadaresponsfromtheFastCGIserver.Thetimeoutissetonlibetweentwosuccessreadoperations,notforthetransmissofthewholeresponse.IftheFastCGIserverdoenottransmitanythwithinthitime,theconnectisclosed.
翻译:定义从 FastCGI 服务器读取响应的超时时间。超时仅在两个连续的读取操作之间设置,而不是针对整个响应的传输。如果 FastCGI 服务器在此时间内没有传输任何内容,则连接将关闭。
出处:http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_read_timeout
微信扫描下方的二维码阅读本文