模拟一个 nginx 499 状态码

关于nginx499的状态码, 无非就是两种情况: 一种服务器响应慢用户点击或跳转终止了当前请求; 一种是服务器响应快, 用户点击终止或跳转更快:). 这里快速模拟一个 nginx 499错误状态码:
建立一个php文件 (index.php):

<?php
if (isset($_GET['js'])) {
      sleep(10);
      exit;
}
?>
<!DOCTYPE html><!-- HTML 5 -->
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<a href="http://www.baidu.com">test</a>
</body>

</html>
<script src="./index.php?js"></script>

http访问这个页面并且点击下面链接’test’后, 看看nginx日志吧, 有没有499状态码?

10.19.8.179 - - [20/May/2013:16:45:02 +0800] "GET /index.php?js HTTP/1.1" 499 0 "http://misc.iforeach.com" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:20.0) Gecko/20100101 Firefox/20.0" "-"
相关的文章:

暂无评论

写评论