简体   繁体   English

nginx - 502一些ajax请求的错误网关

[英]nginx - 502 Bad Gateway for some ajax requests

I get 502 Bad Gateway for some requests on my server. 我的服务器上的一些请求得到502 Bad Gateway。 I get it for some particular AJAX requests but if I replay the failed request in the console, it works (wtf). 我得到了一些特定的AJAX请求但是如果我在控制台中重放失败的请求,它可以工作(wtf)。 In nginx/error.log it says nginx/error.log它说

[error] 13867#0: *74180 recv() failed (104: Connection reset by peer) while reading response header from upstream [错误] 13867#0:* 74180 recv()失败(104:通过对等方连接重置)从上游读取响应头

My website is in PHP. 我的网站是用PHP编写的。 Thanx 感谢名单

I had similar problem with my gitlab setup on nginx. 我在nginx上的gitlab设置遇到了类似的问题。 What helped solve my problem was to higher max client's body size by client_max_body_size 50m directive inside http block of /etc/nginx/nginx.conf file. 有助于解决我的问题的是通过/etc/nginx/nginx.conf文件的http块内的client_max_body_size 50m指令来提高最大客户端的主体大小。

I had similar problem on wordpress site. 我在wordpress网站上遇到了类似的问题。 add these lines inside http block of /etc/nginx/nginx.conf file. /etc/nginx/nginx.conf文件的http块中添加这些行。

fastcgi_temp_file_write_size 10m;
fastcgi_busy_buffers_size 512k;
fastcgi_buffer_size 512k;
fastcgi_buffers 16 512k;

If it still not working also add this line 如果它仍然不起作用也添加此行

 client_max_body_size 50M;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM