VPS侦探论坛

 找回密码
 注册
查看: 6599|回复: 3

502错误 该改的都改了还出现

[复制链接]
发表于 2012-6-13 20:16:14 | 显示全部楼层 |阅读模式

debian系统,,按照置顶的帖子改了,不行,
按照
这个文章:http://www.kuqin.com/web/20120220/318312.html

改了还不行

我的日志文件 /usr/local/php/logs/php-fpm.log内容如下:
  1. Jun 13 19:18:08.343374 [NOTICE] fpm_got_signal(), line 56: received SIGTERM
  2. Jun 13 19:18:08.343428 [NOTICE] fpm_pctl(), line 256: switching to 'terminating' state
  3. Jun 13 19:18:08.343464 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 4767 (pool default)
  4. Jun 13 19:18:08.343483 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 4765 (pool default)
  5. Jun 13 19:18:08.343498 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 4763 (pool default)
  6. Jun 13 19:18:08.343512 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 4762 (pool default)
  7. Jun 13 19:18:08.343529 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 4761 (pool default)
  8. Jun 13 19:18:08.343540 [NOTICE] fpm_pctl_kill_all(), line 181: 5 children are still alive
  9. Jun 13 19:18:08.345361 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
  10. Jun 13 19:18:08.345424 [WARNING] fpm_children_bury(), line 215: child 4762 (pool default) exited on signal 15 SIGTERM after 480.795660 seconds from start
  11. Jun 13 19:18:08.345878 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
  12. Jun 13 19:18:08.345932 [WARNING] fpm_children_bury(), line 215: child 4761 (pool default) exited on signal 15 SIGTERM after 480.798342 seconds from start
  13. Jun 13 19:18:08.345962 [WARNING] fpm_children_bury(), line 215: child 4767 (pool default) exited on signal 15 SIGTERM after 480.789034 seconds from start
  14. Jun 13 19:18:08.346025 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
  15. Jun 13 19:18:08.346077 [WARNING] fpm_children_bury(), line 215: child 4763 (pool default) exited on signal 15 SIGTERM after 480.793935 seconds from start
  16. Jun 13 19:18:08.347985 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
  17. Jun 13 19:18:08.348027 [WARNING] fpm_children_bury(), line 215: child 4765 (pool default) exited on signal 15 SIGTERM after 480.793417 seconds from start
  18. Jun 13 19:18:08.348055 [NOTICE] fpm_pctl_exit(), line 81: exiting, bye-bye!
  19. Jun 13 19:18:09.405286 [NOTICE] fpm_unix_init_main(), line 284: getrlimit(nofile): max:1024, cur:1024
  20. Jun 13 19:18:09.405686 [NOTICE] fpm_event_init_main(), line 88: libevent: using epoll
  21. Jun 13 19:18:09.405759 [NOTICE] fpm_init(), line 52: fpm is running, pid 11894
  22. Jun 13 19:18:09.408197 [NOTICE] fpm_children_make(), line 352: child 11895 (pool default) started
  23. Jun 13 19:18:09.410643 [NOTICE] fpm_children_make(), line 352: child 11896 (pool default) started
  24. Jun 13 19:18:09.413004 [NOTICE] fpm_children_make(), line 352: child 11897 (pool default) started
  25. Jun 13 19:18:09.415279 [NOTICE] fpm_children_make(), line 352: child 11899 (pool default) started
  26. Jun 13 19:18:09.417430 [NOTICE] fpm_children_make(), line 352: child 11900 (pool default) started
  27. Jun 13 19:18:09.417488 [NOTICE] fpm_event_loop(), line 107: libevent: entering main loop
  28. Jun 13 19:41:07.397826 [NOTICE] fpm_got_signal(), line 56: received SIGTERM
  29. Jun 13 19:41:07.397887 [NOTICE] fpm_pctl(), line 256: switching to 'terminating' state
  30. Jun 13 19:41:07.397917 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 11900 (pool default)
  31. Jun 13 19:41:07.397935 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 11899 (pool default)
  32. Jun 13 19:41:07.397953 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 11897 (pool default)
  33. Jun 13 19:41:07.397975 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 11896 (pool default)
  34. Jun 13 19:41:07.397996 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 11895 (pool default)
  35. Jun 13 19:41:07.398009 [NOTICE] fpm_pctl_kill_all(), line 181: 5 children are still alive
  36. Jun 13 19:41:07.400293 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
  37. Jun 13 19:41:07.400375 [WARNING] fpm_children_bury(), line 215: child 11895 (pool default) exited on signal 15 SIGTERM after 1377.992318 seconds from start
  38. Jun 13 19:41:07.400426 [WARNING] fpm_children_bury(), line 215: child 11896 (pool default) exited on signal 15 SIGTERM after 1377.989853 seconds from start
  39. Jun 13 19:41:07.400473 [WARNING] fpm_children_bury(), line 215: child 11897 (pool default) exited on signal 15 SIGTERM after 1377.987541 seconds from start
  40. Jun 13 19:41:07.400510 [WARNING] fpm_children_bury(), line 215: child 11900 (pool default) exited on signal 15 SIGTERM after 1377.983145 seconds from start
  41. Jun 13 19:41:07.400539 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
  42. Jun 13 19:41:07.400550 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
  43. Jun 13 19:41:07.400563 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
  44. Jun 13 19:41:07.402180 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
  45. Jun 13 19:41:07.402241 [WARNING] fpm_children_bury(), line 215: child 11899 (pool default) exited on signal 15 SIGTERM after 1377.987029 seconds from start
  46. Jun 13 19:41:07.402257 [NOTICE] fpm_pctl_exit(), line 81: exiting, bye-bye!
  47. Jun 13 19:41:38.730735 [NOTICE] fpm_unix_init_main(), line 284: getrlimit(nofile): max:4096, cur:1024
  48. Jun 13 19:41:38.732919 [NOTICE] fpm_event_init_main(), line 88: libevent: using epoll
  49. Jun 13 19:41:38.733152 [NOTICE] fpm_init(), line 52: fpm is running, pid 1795
  50. Jun 13 19:41:38.735363 [NOTICE] fpm_children_make(), line 352: child 1796 (pool default) started
  51. Jun 13 19:41:38.737322 [NOTICE] fpm_children_make(), line 352: child 1797 (pool default) started
  52. Jun 13 19:41:38.739549 [NOTICE] fpm_children_make(), line 352: child 1798 (pool default) started
  53. Jun 13 19:41:38.741747 [NOTICE] fpm_children_make(), line 352: child 1799 (pool default) started
  54. Jun 13 19:41:38.743998 [NOTICE] fpm_children_make(), line 352: child 1801 (pool default) started
  55. Jun 13 19:41:38.744085 [NOTICE] fpm_event_loop(), line 107: libevent: entering main loop
  56. Jun 13 19:48:22.833659 [NOTICE] fpm_got_signal(), line 56: received SIGTERM
  57. Jun 13 19:48:22.833716 [NOTICE] fpm_pctl(), line 256: switching to 'terminating' state
  58. Jun 13 19:48:22.833750 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 1801 (pool default)
  59. Jun 13 19:48:22.833767 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 1799 (pool default)
  60. Jun 13 19:48:22.833790 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 1798 (pool default)
  61. Jun 13 19:48:22.833812 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 1797 (pool default)
  62. Jun 13 19:48:22.833833 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 1796 (pool default)
  63. Jun 13 19:48:22.833846 [NOTICE] fpm_pctl_kill_all(), line 181: 5 children are still alive
  64. Jun 13 19:48:22.835233 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
  65. Jun 13 19:48:22.835310 [WARNING] fpm_children_bury(), line 215: child 1801 (pool default) exited on signal 15 SIGTERM after 403.813830 seconds from start
  66. Jun 13 19:48:22.835599 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
  67. Jun 13 19:48:22.835667 [WARNING] fpm_children_bury(), line 215: child 1797 (pool default) exited on signal 15 SIGTERM after 403.820855 seconds from start
  68. Jun 13 19:48:22.835737 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
  69. Jun 13 19:48:22.835782 [WARNING] fpm_children_bury(), line 215: child 1799 (pool default) exited on signal 15 SIGTERM after 403.816553 seconds from start
  70. Jun 13 19:48:22.836005 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
  71. Jun 13 19:48:22.836048 [WARNING] fpm_children_bury(), line 215: child 1798 (pool default) exited on signal 15 SIGTERM after 403.819034 seconds from start
  72. Jun 13 19:48:22.837688 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
  73. Jun 13 19:48:22.837750 [WARNING] fpm_children_bury(), line 215: child 1796 (pool default) exited on signal 15 SIGTERM after 403.824943 seconds from start
  74. Jun 13 19:48:22.837768 [NOTICE] fpm_pctl_exit(), line 81: exiting, bye-bye!
  75. Jun 13 19:49:07.708442 [NOTICE] fpm_unix_init_main(), line 284: getrlimit(nofile): max:4096, cur:1024
  76. Jun 13 19:49:07.726680 [NOTICE] fpm_event_init_main(), line 88: libevent: using epoll
  77. Jun 13 19:49:07.727023 [NOTICE] fpm_init(), line 52: fpm is running, pid 1819
  78. Jun 13 19:49:07.728761 [NOTICE] fpm_children_make(), line 352: child 1820 (pool default) started
  79. Jun 13 19:49:07.730547 [NOTICE] fpm_children_make(), line 352: child 1821 (pool default) started
  80. Jun 13 19:49:07.732509 [NOTICE] fpm_children_make(), line 352: child 1822 (pool default) started
  81. Jun 13 19:49:07.734281 [NOTICE] fpm_children_make(), line 352: child 1823 (pool default) started
  82. Jun 13 19:49:07.736230 [NOTICE] fpm_children_make(), line 352: child 1825 (pool default) started
  83. Jun 13 19:49:07.736288 [NOTICE] fpm_event_loop(), line 107: libevent: entering main loop
复制代码
top  内容如下:


  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
1825 www       20   0 26032  10m 5208 R  100  2.1  16:29.41 php-cgi
1820 www       20   0 26792  11m 5204 R   83  2.2  15:02.53 php-cgi
1821 www       20   0 24772 9.8m 5552 R   78  2.0  15:35.50 php-cgi
1823 www       20   0 24960 9516 5148 S   46  1.9  14:33.31 php-cgi
1822 www       20   0 26852  11m 5160 R   44  2.3  15:06.76 php-cgi
1765 root      20   0 46924  772  512 S    0  0.2   0:00.05 memcached


CPU利用太高了。。。高手帮忙解决一下。。。谢谢了。

系统平均负载3.75 3.37 2.43 4/85

运行了几个纯php程序是不是太资源了??

[ 本帖最后由 sofeng 于 2012-6-14 13:49 编辑 ]
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-6-13 22:11:52 | 显示全部楼层


置顶帖502排查里的https://bbs.vpser.net/thread-1654-1-1.html 试试
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2012-6-14 01:36:27 | 显示全部楼层

改了改 希望可以加了个重启脚本,,希望可以对大家有帮助。

LNMP-502自动重启脚本

   使用lnmp的同学经常会遇到nginx出现502的情况,有些时候无论怎么调整,都不能解决问题,如果在睡觉的时候出现问题,而自己又没有检查,那流量不就白白浪费了吗?
   下面我介绍一种方法,完全可以监测到502然后自动重启php-fpm

在SSH中新建一个文件
SSH中输入:

vi 502.sh
在文件中输入如下内容
#!/usr/bin/php
<?
$url = 'https://www.vpser.net';
$cmd = '/usr/local/php/sbin/php-fpm restart';

for($i = 0; $i < 5; $i ++){
$exec = "curl --connect-timeout 3 -I $url 2>/dev/null";
$res = shell_exec($exec);

if(stripos($res,'502 Bad Gateway') !== false){
shell_exec($cmd);
exit();
}
}
?>
然后保存,其中的网址设置你这台VPS上的任意网页


赋予777权限


chmod 777 /root/502.sh
下一步我们设置上定时

crontab使用方法

SSH中输入crontab -e

输入:

*/1 * * * * /root/502.sh
这样就可以自动检测网页如果是502 就自动重启
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-6-14 13:50:12 | 显示全部楼层
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-23 05:32 , Processed in 0.026324 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表