试用Nginx + PHP FastCGI 做WEB服务器,运行了几个月的时间,烦恼的是经常碰到Nginx 502 Bad Gateway 这个问题。
参考了很多修改办法,这个502的问题一直存在,今天打算重装PHP FastCGI到PHP的安装目录里一看,发现PHP的日志文件已经有几十M的大小,打开一看,结果基本全部都是一下的错误:
Jan 11 08:54:01.164292 [NOTICE] fpm_children_make(), line 352: child 10088 (pool default) started
Jan 11 08:54:01.164325 [WARNING] fpm_children_bury(), line 215: child 7985 (pool default) exited on signal 15 SIGTERM after 63.778601 seconds from start
Jan 11 08:54:01.165485 [NOTICE] fpm_children_make(), line 352: child 10089 (pool default) started
Jan 11 08:54:01.165514 [WARNING] fpm_children_bury(), line 215: child 7999 (pool default) exited on signal 15 SIGTERM after 60.297326 seconds from start
Jan 11 08:54:01.166696 [NOTICE] fpm_children_make(), line 352: child 10090 (pool default) started
Jan 11 08:54:01.166727 [WARNING] fpm_children_bury(), line 215: child 8000 (pool default) exited on signal 15 SIGTERM after 60.296946 seconds from start
Jan 11 08:54:01.167855 [NOTICE] fpm_children_make(), line 352: child 10091 (pool default) started
Jan 12 04:00:50.443884 [NOTICE] fpm_children_make(), line 352: child 10127 (pool default) started
Jan 12 04:00:50.443917 [NOTICE] fpm_event_loop(), line 107: libevent: entering main loop
Jan 12 12:05:08.425141 [WARNING] fpm_request_check_timed_out(), line 158: child 10120, script '/home/htdocs/www/index.php' (pool default) execution timed out (30.051306 sec), terminating
Jan 12 12:05:08.929741 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jan 12 12:05:09.137341 [WARNING] fpm_children_bury(), line 215: child 10120 (pool default) exited on signal 15 SIGTERM after 29058.697774 seconds from start
Jan 13 01:16:43.058020 [NOTICE] fpm_pctl_exit(), line 81: exiting, bye-bye!
Jan 13 01:16:46.236418 [NOTICE] fpm_unix_init_main(), line 284: getrlimit(nofile): max:52000, cur:52000
Jan 13 01:16:46.236655 [NOTICE] fpm_event_init_main(), line 88: libevent: using epoll
Jan 13 01:16:46.610883 [NOTICE] fpm_init(), line 52: fpm is running, pid 14095
Jan 13 01:16:46.612247 [NOTICE] fpm_children_make(), line 352: child 14103 (pool default) started
Jan 13 01:16:46.613190 [NOTICE] fpm_children_make(), line 352: child 14104 (pool default) started
Jan 13 01:16:46.614159 [NOTICE] fpm_children_make(), line 352: child 14105 (pool default) started
Jan 13 01:16:46.615627 [NOTICE] fpm_children_make(), line 352: child 14106 (pool default) started
Jan 13 01:16:46.616362 [NOTICE] fpm_children_make(), line 352: child 14107 (pool default) started
Jan 13 01:16:46.617045 [NOTICE] fpm_children_make(), line 352: child 14108 (pool default) started
Jan 13 01:17:33.243576 [WARNING] fpm_request_check_timed_out(), line 158: child 14103, script '/home/htdocs/www/index.php' (pool default) execution timed out (34.024787 sec), terminating
Jan 13 01:17:33.244174 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jan 13 01:17:33.244228 [WARNING] fpm_children_bury(), line 215: child 14103 (pool default) exited on signal 15 SIGTERM after 46.632004 seconds from start
Jan 13 01:17:33.250331 [NOTICE] fpm_children_make(), line 352: child 15488 (pool default) started
Jan 13 01:27:23.052006 [WARNING] fpm_request_check_timed_out(), line 158: child 14106, script '/home/htdocs/www/index.php' (pool default) execution timed out (30.035273 sec), terminating
Jan 13 01:27:23.902504 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jan 13 01:27:23.939140 [WARNING] fpm_children_bury(), line 215: child 14106 (pool default) exited on signal 15 SIGTERM after 637.323523 seconds from start
Jan 13 01:27:23.940355 [NOTICE] fpm_children_make(), line 352: child 1658 (pool default) started
Jan 13 01:27:34.398321 [WARNING] fpm_request_check_timed_out(), line 158: child 14107, script '/home/htdocs/www/index.php' (pool default) execution timed out (30.076368 sec), terminating
Jan 13 01:27:34.529319 [WARNING] fpm_request_check_timed_out(), line 158: child 14107, script '/home/htdocs/www/index.php' (pool default) execution timed out (30.207367 sec), terminating
Jan 13 08:09:44.189826 [NOTICE] fpm_children_make(), line 352: child 30465 (pool default) started
Jan 13 08:10:08.045110 [NOTICE] fpm_children_make(), line 352: child 31815 (pool default) started
Jan 13 09:15:20.604471 [WARNING] fpm_request_check_timed_out(), line 158: child 31813, script '/home/htdocs/www/index.php' (pool default) execution timed out (30.006392 sec), terminating
Jan 13 09:15:21.615288 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jan 13 09:15:21.615347 [WARNING] fpm_children_bury(), line 215: child 31813 (pool default) exited on signal 15 SIGTERM after 3913.810239 seconds from start
Jan 13 11:06:18.645301 [WARNING] fpm_request_check_timed_out(), line 158: child 1905, script '/home/htdocs/www/index.php' (pool default) execution timed out (30.019438 sec), terminating
Jan 13 11:06:19.189703 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jan 13 11:06:19.262665 [WARNING] fpm_children_bury(), line 215: child 1905 (pool default) exited on signal 15 SIGTERM after 34719.959291 seconds from start
Jan 13 11:06:19.264634 [NOTICE] fpm_children_make(), line 352: child 23748 (pool default) started
Jan 13 22:05:29.623956 [WARNING] fpm_request_check_timed_out(), line 158: child 9412, script '/home/htdocs/www/index.php' (pool default) execution timed out (30.038766 sec), terminating
Jan 13 22:05:29.940748 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jan 13 22:05:30.118247 [WARNING] fpm_children_bury(), line 215: child 9412 (pool default) exited on signal 15 SIGTERM after 41228.780226 seconds from start
Jan 13 22:05:30.120231 [NOTICE] fpm_children_make(), line 352: child 30489 (pool default) started
Jan 13 22:11:15.155278 [WARNING] fpm_request_check_timed_out(), line 158: child 12118, script '/home/htdocs/www/index.php' (pool default) execution timed out (30.027702 sec), terminating
Jan 13 22:11:20.906721 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jan 13 22:11:22.375915 [WARNING] fpm_children_bury(), line 215: child 12118 (pool default) exited on signal 15 SIGTERM after 41371.257053 seconds from start
Jan 13 22:11:22.377362 [NOTICE] fpm_children_make(), line 352: child 15899 (pool default) started
Jan 13 22:16:30.459322 [NOTICE] fpm_got_signal(), line 56: received SIGTERM
Jan 13 22:16:30.600664 [NOTICE] fpm_pctl(), line 256: switching to 'terminating' state
Jan 13 22:16:30.601166 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 15899 (pool default)
Jan 13 22:16:30.601439 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 30489 (pool default)
Jan 13 22:16:30.604748 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 23748 (pool default)
Jan 13 22:16:30.608901 [NOTICE] fpm_pctl_kill_all(), line 172: sending signal 15 SIGTERM to child 32323 (pool default)
Jan 13 22:16:30.652696 [WARNING] fpm_children_bury(), line 215: child 3515 (pool default) exited on signal 15 SIGTERM after 53860.208516 seconds from start
Jan 13 22:16:30.652735 [WARNING] fpm_children_bury(), line 215: child 30465 (pool default) exited on signal 15 SIGTERM after 50806.462919 seconds from start
Jan 13 22:16:30.652773 [WARNING] fpm_children_bury(), line 215: child 31812 (pool default) exited on signal 15 SIGTERM after 50782.848515 seconds from start
Jan 13 22:16:30.683815 [WARNING] fpm_children_bury(), line 215: child 31815 (pool default) exited on signal 15 SIGTERM after 50782.638716 seconds from start
Jan 13 22:16:30.683868 [WARNING] fpm_children_bury(), line 215: child 32323 (pool default) exited on signal 15 SIGTERM after 46869.067366 seconds from start
Jan 13 22:16:30.683907 [WARNING] fpm_children_bury(), line 215: child 23748 (pool default) exited on signal 15 SIGTERM after 40211.419289 seconds from start
Jan 13 22:16:30.683947 [WARNING] fpm_children_bury(), line 215: child 30489 (pool default) exited on signal 15 SIGTERM after 660.563729 seconds from start
Jan 13 22:16:30.683987 [WARNING] fpm_children_bury(), line 215: child 15899 (pool default) exited on signal 15 SIGTERM after 308.306637 seconds from start
Jan 13 22:16:30.684008 [NOTICE] fpm_pctl_exit(), line 81: exiting, bye-bye!
Jan 13 22:16:38.214052 [NOTICE] fpm_unix_init_main(), line 284: getrlimit(nofile): max:52000, cur:52000
Jan 13 22:16:38.214303 [NOTICE] fpm_event_init_main(), line 88: libevent: using epoll
Jan 13 22:16:38.214366 [NOTICE] fpm_init(), line 52: fpm is running, pid 22086
Jan 13 22:16:38.215305 [NOTICE] fpm_children_make(), line 352: child 22089 (pool default) started
Jan 13 22:16:38.216038 [NOTICE] fpm_children_make(), line 352: child 22090 (pool default) started
Jan 13 22:16:38.216738 [NOTICE] fpm_children_make(), line 352: child 22091 (pool default) started
Jan 13 22:16:38.217453 [NOTICE] fpm_children_make(), line 352: child 22092 (pool default) started
Jan 13 22:16:38.218000 [NOTICE] fpm_children_make(), line 352: child 22093 (pool default) started
Jan 13 22:16:38.218890 [NOTICE] fpm_children_make(), line 352: child 22094 (pool default) started
Jan 13 22:16:38.219617 [NOTICE] fpm_children_make(), line 352: child 22095 (pool default) started
Jan 13 22:16:38.225531 [NOTICE] fpm_event_loop(), line 107: libevent: entering main loop
Jan 13 22:17:27.370069 [WARNING] fpm_request_check_timed_out(), line 158: child 22089, script '/home/htdocs/www/index.php' (pool default) execution timed out (30.038985 sec), terminating
Jan 13 22:17:27.468485 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jan 13 22:17:27.468544 [WARNING] fpm_children_bury(), line 215: child 22089 (pool default) exited on signal 15 SIGTERM after 49.253256 seconds from start
Jan 13 22:17:27.469667 [NOTICE] fpm_children_make(), line 352: child 24464 (pool default) started
Jan 13 22:19:31.308673 [WARNING] fpm_request_check_timed_out(), line 158: child 22091, script '/home/htdocs/www/index.php' (pool default) execution timed out (30.017504 sec), terminating
Jan 13 22:19:31.391669 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jan 13 22:19:31.391726 [WARNING] fpm_children_bury(), line 215: child 22091 (pool default) exited on signal 15 SIGTERM after 173.174998 seconds from start
Jan 13 22:19:31.392806 [NOTICE] fpm_children_make(), line 352: child 26115 (pool default) started
Jan 13 22:19:54.583311 [WARNING] fpm_request_check_timed_out(), line 158: child 22092, script '/home/htdocs/blog/index.php' (pool default) execution timed out (30.059096 sec), terminating
Jan 13 22:19:54.714265 [WARNING] fpm_request_check_timed_out(), line 158: child 22092, script '/home/htdocs/blog/index.php' (pool default) execution timed out (30.190051 sec), terminating
Jan 13 22:19:55.150269 [WARNING] fpm_request_check_timed_out(), line 158: child 22092, script '/home/htdocs/blog/index.php' (pool default) execution timed out (30.626056 sec), terminating
Jan 13 22:19:55.280294 [WARNING] fpm_request_check_timed_out(), line 158: child 22092, script '/home/htdocs/blog/index.php' (pool default) execution timed out (30.756072 sec), terminating
Jan 14 04:25:10.246332 [NOTICE] fpm_children_make(), line 352: child 19682 (pool default) started
Jan 14 04:26:46.671126 [WARNING] fpm_request_check_timed_out(), line 158: child 5197, script '/home/htdocs/www/index.php' (pool default) execution timed out (30.014729 sec), terminating
Jan 14 04:26:46.673180 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jan 14 04:26:46.673227 [WARNING] fpm_children_bury(), line 215: child 5197 (pool default) exited on signal 15 SIGTERM after 11397.233579 seconds from start
Jan 14 04:26:46.674141 [NOTICE] fpm_children_make(), line 352: child 21862 (pool default) started
Jan 14 04:28:36.335704 [WARNING] fpm_request_check_timed_out(), line 158: child 22099, script '/home/htdocs/www/index.php' (pool default) execution timed out (30.007718 sec), terminating
Jan 14 04:28:36.338527 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jan 14 04:28:36.338580 [WARNING] fpm_children_bury(), line 215: child 22099 (pool default) exited on signal 15 SIGTERM after 22318.115787 seconds from start
Jan 14 04:28:36.339512 [NOTICE] fpm_children_make(), line 352: child 24364 (pool default) started
Jan 14 04:28:36.597695 [WARNING] fpm_request_check_timed_out(), line 158: child 13424, script '/home/htdocs/www/index.php' (pool default) execution timed out (30.047650 sec), terminating
Jan 14 04:28:36.601724 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jan 14 04:28:36.601783 [WARNING] fpm_children_bury(), line 215: child 13424 (pool default) exited on signal 15 SIGTERM after 10378.102868 seconds from start
Jan 14 04:28:36.602722 [NOTICE] fpm_children_make(), line 352: child 24366 (pool default) started
Jan 14 04:31:25.990795 [WARNING] fpm_request_check_timed_out(), line 158: child 22102, script '/home/htdocs/www/index.php' (pool default) execution timed out (30.006149 sec), terminating
Jan 14 04:31:25.993590 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jan 14 04:31:25.993646 [WARNING] fpm_children_bury(), line 215: child 22102 (pool default) exited on signal 15 SIGTERM after 22487.768873 seconds from start
Jan 14 04:31:25.994576 [NOTICE] fpm_children_make(), line 352: child 1777 (pool default) started
Jan 14 04:31:46.625603 [WARNING] fpm_request_check_timed_out(), line 158: child 22103, script '/home/htdocs/www/index.php' (pool default) execution timed out (30.074709 sec), terminating
Jan 14 04:31:46.628291 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jan 14 04:31:46.628359 [WARNING] fpm_children_bury(), line 215: child 22103 (pool default) exited on signal 15 SIGTERM after 22508.402867 seconds from start
查过网上的资源,基本都是认为是php线程打开文件句柄受限导致的错误。具体的解决的办法如下:
1、提升服务器的文件句柄打开打开
/etc/security/limits.conf : (增加)
* soft nofile 51200
* hard nofile 51200
# vi /etc/security/limits.conf 加上
* soft nofile 51200
* hard nofile 51200
2、提升nginx的进程文件打开数
nginx.conf : worker_rlimit_nofile 51200;
3、修改php-fpm.conf文件,主要需要修改2处。
命令 ulimit -n 查看限制的打开文件数,php-fpm.conf 中的选项rlimit_files 确保和此数值一致。
<value name="max_requests">10240</value>
<value name="rlimit_files">51200</value>
4、
# vi /etc/sysctl.conf
底部添加
fs.file-max=51200
完成以上修改,重启PHP,警告信息再也没了。
世界从此安宁,502 Bad Gateway 没有了。
- nginx下php频繁卡死502
解决:[WARNING] fpm_children_bury(), line 215: child 2736 (pool default) exited on signal 15 SIGTERM af ...
- 安装python File "/usr/bin/pip", line 11, in <module> sys.exit(main()) File "/usr/lib/python3.4/site-packages/pip/__init__.py", line 215, in main locale.setlocale(locale.LC_ALL, '') File "/u
$ uname -a Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u6 (2015-11-09) x86_64 GNU ...
- php-fpm 老是warning 进程退出问题
http://yangjunwei.com/a/723.html 分析Centos系统下LNMP频繁502 Bad Gateway问题 2012-01-28 杨俊伟 ) 最近VPS总是出现 N ...
- ORA-00379: no free buffers available in buffer pool DEFAULT for block size 16K
SYS@orcl> select TABLESPACE_NAME ,AUTOEXTENSIBLE from dba_data_files ; ERROR: ORA-00379: no free ...
- redis启动错误: Warning: no config file specified, using the default config. In order to specify a config
redis启动错误: Warning: no config file specified, using the default config. In order to specify a config ...
- 练习2-15 求简单交错序列前N项和 (15 分)
练习2-15 求简单交错序列前N项和 (15 分) 本题要求编写程序,计算序列 1 - 1/4 + 1/7 - 1/10 + ... 的前N项之和. 输入格式: 输入在一行中给出一个正整数N. 输出格 ...
- linux服务器WEB环境一键安装包lanmp教程之五
在我们安装了linux服务器WEB环境一键安装包lanmp后,可能会有不少疑问还有就是使用过程中出现的问题,下面为大家总结几点比较常见的,如若还有其他疑问,可到wdlinux论坛寻找相关教程. 1.增 ...
- 解决Warning: unlink(/storage/cache/cache.catalog.language.1556158719): No such file or directory in /system/library/cache/file.php on line 68问题
ytkah在调试opencart项目时提示Warning: unlink(/storage/cache/cache.catalog.language.1556158719): No such file ...
- 502 解决:[WARNING] fpm_children_bury
查过网上的资源,基本都是认为是php线程打开文件句柄受限导致的错误.具体的解决的办法如下: 1.提升服务器的文件句柄打开打开 /etc/security/limits.conf : (增加) * ...
随机推荐
- javascript实现选项卡切换的4种方法
方法一:for循环+if判断当前点击与自定义数组是否匹配 <html lang="en"> <head> <meta charset="UT ...
- MySQL 5.6 Reference Manual-14.3 InnoDB Transaction Model and Locking
14.3 InnoDB Transaction Model and Locking 14.3.1 InnoDB Lock Modes 14.3.2 InnoDB Record, Gap, and Ne ...
- axis2服务器搭建
一. axis2服务器搭建 简单起见, axis2r搭建采用较为简单的一种方式, 即将服务类和services.xml打成.aar包发布. 1. 下载部署axis2 http://axis.apach ...
- 使用Caffe预测遇到的问题
1. 在使用网络预测图像时, prediction = net.predict( [input_image] ) 出现: net.image_dims[0] 不是整数情况, (2).甚至以为np.ze ...
- DeepMind用ReinforcementLearning玩游戏
原文 : http://dataunion.org/?p=639 1.引言 说到机器学习最酷的分支,非Deep learning和Reinforcement learning莫属(以下分别简称DL和 ...
- ZBrush关于遮罩的一些操作
本文讨论使用ZBrush®软件如何在屏幕上创建遮罩和操纵遮罩. 1. 绘制遮罩 按下Ctrl键你就能够在你的模型上绘制遮罩(笔刷的笔划的开始和结束都必须在模型上),默认情况下,遮罩区域在模型上显示为一 ...
- Spring中xml文档的schema约束
最开始使用Spring框架的时候,对于其配置文件xml,只是网上得知其使用方法,而不明其意.最近想着寻根问底的探究一下.以下是本文主要内容: 1.配置文件示例. <?xml version= ...
- 从U盘安装CentOS7.3教程(转载)
0.准备工作: 一台没系统的普通电脑u盘一个(大于1G,最小安装的话不超过1G,根据选择系统大小匹配U盘即可) CentOS7.3 iso文件一个UltraISO工具 1.制作U盘 ①使用UltraI ...
- SQL SEVER (ROLLUP与CUBE,ROW_NUMBER())使用方法
1.建立测试专用数据: if object_id('TESTDB') is not null drop table TESTDB ), B INT) insert into TESTDB union ...
- Python笔记11------一个K-means聚类的小例子
#导入scipy库,库中已经有实现的kmeans模块,直接使用, #根据六个人的分数分为学霸或者学渣两类 import numpy as np from scipy.cluster.vq import ...