多个POST请求后我没有收到来自服务器的数据 [英] I receive no data from server after multiple POST requests
问题描述
我一直在努力解决一个问题,即多个POST请求似乎在几分钟内使服务器崩溃(站点无法加载,不允许请求). GET请求不会导致此问题.
I've been struggling with a problem where multiple POST requests seemingly crash the server (site won't load, no requests allowed) for a couple minutes. GET requests do not cause this issue.
这不是代码问题,代码工作正常
服务器配置可能与之有关.
It's likely something with my server config.
前端JS示例:
$(".searchbox").keyup(function() {
var data = $('.searchbox').val();
$.ajax({
url: "../assets/php/graphenesearch.php",
method: "POST",
data: {
data: data
},
async: true,
dataType: "html"
}).done(function(msg) {
$(".search-output").html(msg);
});
});
后端PHP示例:
$input = $_POST['data'];
echo $input;
即使使用这种简单的代码,我也遇到了问题.因此,显然与请求数有关,而不与传递的数据量有关.
Even with this simple of code, I'm having issues. So it's clearly with the number of requests and not the amount of data being passed.
服务器允许大约40个请求,但随后停止运行.
The server allows ~40 requests, but then stops functioning.
我收到此错误:
POST http://www.graphenesearch.co/assets/php/graphenesearch.php net::ERR_EMPTY_RESPONSE
这可能是显而易见的事情吧?服务器配置?
It's probably something obvious right? Server config?
推荐答案
为您提供详细的答案,如果服务器端的请求处理存在任何问题
Giving you a detailed answer if there is any problem with request handling in server side there will be several problems
-
服务器网络(您的代码没有任何问题,有时数据中心会遇到Internet连接问题.对数据中心的DDOS攻击也会对处理请求造成破坏)
Server Network ( You don't have any problem with you code , sometime some data center face internet connection problem . DDOS attacks on data center can also cause damage on processing request )
获取过多请求(每个Web服务器都有一些限制,因为服务器上无法处理过多请求.在低质量共享托管或低质量OpenCV托管中,您将面临此类问题.有点问题)
Getting too much request ( Every web server have some limitation because on server can not handle too much request . In Low quality shared hosting or Low quality OpenCV hosting you'll face this kind of problem . Even I faced this kind of a problem)
PHP配置错误,您的php可能配置不正确.也许那造成了所有的损害.打开php日志文件进行检查.配置修复后,请重新启动服务器.
PHP Configuration error , you'r php might not configured correctly . maybe that is causing all damage . Open the php log file to check there. after configuration fix PLEASE RESTART YOUR SERVER.
这篇关于多个POST请求后我没有收到来自服务器的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!