试用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 : (增加) * ...
随机推荐
- 【Oracle】权限
1. 授予权限: GRANT privilege[, privilege...] TO user [, user| role, PUBLIC...]; ①DBA授予用户系统权限 GRANT creat ...
- 开发一款合格的APP成本费用大概是多少?
随着移动互联网的发展,APP开发已经成了当下最热门的话题.无数人都盼望做出下一个微信.滴滴打车等等神奇的APP软件.如今,APP开发门槛已经非常低,媒体上也充斥着各种小团队创造奇迹的故事.不过,APP ...
- mongodb主从副本集配置
创建路径: mkdir -p /datassd/mongo_20011/{data,conf,log} 配置文件示例: #mongo.conf dbpath=/datassd/mongo/da ...
- What are lazy variables?
Written by Paul Hudson @twostraws It's very common in iOS to want to create complex objects only ...
- [SOA]REST与SOA两种架构的异同比较
REST的特性 它基于HTTP协议,是一种明确构建在客户端/服务端体系结构上的一种风格.特征如下: 1.网络上的资源都被抽象为资源,这些资源都具有唯一的统一资源标识符(URI:Uniform Reso ...
- vc++文本框的编辑
新建mfc应用程序,单文档,起名Text,先编译一下 首先要创建一个插入符,用CreateSolid 窗口的高度宽度,可以通过GetSystemMetrics()函数获取 视类是覆盖在框架类之上的 创 ...
- JavaScript进阶【二】JavaScript 严格模式(use strict)的使用
/*** *使用严格模式的原因: * ①:消除Javascript语法的一些不合理.不严谨之处,减少一些怪异行为; ②:消除代码运行的一些不安全之处,保证代码运行的安全: ③:提高编译器效率,增加运行 ...
- nyoj158-省赛来了
省赛来了 时间限制:1000 ms | 内存限制:65535 KB 难度:2 描述 一年一度的河南省程序设计大赛又要来了. 竞赛是要组队的,组队形式:三人为一队,设队长一名,队员两名. 现在问题就 ...
- String,StringBuffer,StringBuild的区别
1.三者在执行速度方面的比较:StringBuilder > StringBuffer > String 2.String <(StringBuffer,StringBuild ...
- Linux 基础入门一
操作系统1.简介OS: Operating System,通用目的的软件程序操作系统的内核(kernel): 操作系统其实也是一组程序.这组程序的重点在于管理计算机的所有活动及驱动系统中的所有硬件: ...