当前位置:Gxlcms > PHP教程 > apache-奇怪的现象,PHP网站访问首页一直HTTP408错误

apache-奇怪的现象,PHP网站访问首页一直HTTP408错误

时间:2021-07-01 10:21:17 帮助过:26人阅读

奇怪现象

1)每次看Apache访问日志,总是很多408错误

网站 .htaccess 配置及顺序

  1. <code> #非3www重定向在DNSPOD中已设置
  2. RewriteCond %{HTTP_HOST} ^myhost.cn [NC]
  3. RewriteRule ^(.*)$ http://www.myhost.cn/$1 [L,R=301]
  4. #非3www重定向在DNSPOD中已设置
  5. RewriteCond %{HTTP_HOST} !^(mywww|localhost|192.168.) [NC]
  6. RewriteCond %{HTTP_HOST} !(my.(cn|loc|test))$ [NC]
  7. RewriteRule ^(.*)$ http://www.myhost.cn/$1 [L,R=301]
  8. RewriteCond %{REQUEST_FILENAME} !-f
  9. RewriteCond %{REQUEST_FILENAME} !-d
  10. RewriteCond %{REQUEST_FILENAME} !(xml|html|php)$
  11. RewriteCond %{REQUEST_URI} !\/$
  12. RewriteRule ^(.*)$ /$1/ [L,R=301]
  13. </code>

Apache 访问日志

  1. <code>2014-12-23 15:44:46 119.130.186.24 - myhost.cn- - 80 "-" 408 0 0 "from:-"
  2. 2014-12-23 15:44:46 119.130.186.24 - myhost.cn- - 80 "-" 408 0 0 "from:-"
  3. 2014-12-23 15:44:51 119.130.186.24 - myhost.cn- - 80 "-" 408 0 0 "from:-"
  4. 2014-12-23 15:44:51 119.130.186.24 - myhost.cn- - 80 "-" 408 0 0 "from:-"
  5. 2014-12-23 15:44:51 119.130.186.24 - myhost.cn- - 80 "-" 408 0 0 "from:-"
  6. 2014-12-23 15:44:51 119.130.186.24 - myhost.cn- - 80 "-" 408 0 0 "from:-"
  7. 2014-12-23 15:44:51 119.130.186.24 - myhost.cn- - 80 "-" 408 0 0 "from:-"
  8. </code>

奇怪的问题

  1. <code>不知道这些408访问是怎么产生的,没有访问来路也没有请求浏览器信息,就是408,每天都有很多,至少几十个。
  2. </code>

回复内容:

奇怪现象

1)每次看Apache访问日志,总是很多408错误

网站 .htaccess 配置及顺序

  1. <code> #非3www重定向在DNSPOD中已设置
  2. RewriteCond %{HTTP_HOST} ^myhost.cn [NC]
  3. RewriteRule ^(.*)$ http://www.myhost.cn/$1 [L,R=301]
  4. #非3www重定向在DNSPOD中已设置
  5. RewriteCond %{HTTP_HOST} !^(mywww|localhost|192.168.) [NC]
  6. RewriteCond %{HTTP_HOST} !(my.(cn|loc|test))$ [NC]
  7. RewriteRule ^(.*)$ http://www.myhost.cn/$1 [L,R=301]
  8. RewriteCond %{REQUEST_FILENAME} !-f
  9. RewriteCond %{REQUEST_FILENAME} !-d
  10. RewriteCond %{REQUEST_FILENAME} !(xml|html|php)$
  11. RewriteCond %{REQUEST_URI} !\/$
  12. RewriteRule ^(.*)$ /$1/ [L,R=301]
  13. </code>

Apache 访问日志

  1. <code>2014-12-23 15:44:46 119.130.186.24 - myhost.cn- - 80 "-" 408 0 0 "from:-"
  2. 2014-12-23 15:44:46 119.130.186.24 - myhost.cn- - 80 "-" 408 0 0 "from:-"
  3. 2014-12-23 15:44:51 119.130.186.24 - myhost.cn- - 80 "-" 408 0 0 "from:-"
  4. 2014-12-23 15:44:51 119.130.186.24 - myhost.cn- - 80 "-" 408 0 0 "from:-"
  5. 2014-12-23 15:44:51 119.130.186.24 - myhost.cn- - 80 "-" 408 0 0 "from:-"
  6. 2014-12-23 15:44:51 119.130.186.24 - myhost.cn- - 80 "-" 408 0 0 "from:-"
  7. 2014-12-23 15:44:51 119.130.186.24 - myhost.cn- - 80 "-" 408 0 0 "from:-"
  8. </code>

奇怪的问题

  1. <code>不知道这些408访问是怎么产生的,没有访问来路也没有请求浏览器信息,就是408,每天都有很多,至少几十个。
  2. </code>

408 Request Timeout

维基百科上都有说的。这个信息表明有人以较慢的速度在向你的服务器发送请求。可能是:

  1. 用户在手动输入数据
  2. 用户的网络慢死了
  3. 用户想通过这种方式进行 DoS 攻击
  4. 用户的程序出错了

后边的「from:-」不知道是什么字段。大概是 UserAgent?

人气教程排行