试用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 : (增加) * ...
随机推荐
- Eric6中编译窗体时,弹出提示:无法启动pyuic5的解决方案
用 Eric6 与 PyQt5 结合,非常方便的实现界面与逻辑分离,满足python的极速GUI编程,不需要在界面上花很多时间. 这是一对GUI开发完美的组合! Eric6中设计窗体时,弹出提示:‘无 ...
- javascript实现选项卡切换的4种方法
方法一:for循环+if判断当前点击与自定义数组是否匹配 <html lang="en"> <head> <meta charset="UT ...
- 关于dlg和pro的问题
微软链接:http://technet.microsoft.com/zh-cn/subscriptions/bb983387.aspx CDialogEx::CDialogEx 构造 CDialogE ...
- SPL类
用途:对类,方法,属性,参数的提取生成文档:自动加载插件 实列化类同于new:$ref = new ReflectionClass($classname);$class = $ref->newI ...
- Swift - 关键字(typealias、associatedtype)
Typealias typealias 是用来为已经存在的类型重新定义名字的,通过命名,可以使代码变得更加清晰.使用的语法也很简单,使用typealias 关键字像使用普通的赋值语句一样,可以将某个已 ...
- UWP 利用DataGrid控件创建表格
通过 Nuget 搜索 Microsoft.Toolkit.Uwp.UI.Controls.DataGrid 安装库,在XAML文件中添加引用库 xmlns:controls="using: ...
- Flask框架函数
title: flask学习笔记 subtitle: 1. flask框架函数 date: 2018-12-14 10:17:28 --- Flask学习 学习Miguel Grinberg的2017 ...
- javaee 文件的写入
package Shurushucu; import java.io.FileNotFoundException; import java.io.FileOutputStream; import ja ...
- 路飞学城Python-Day79
27-url控制器之path方法 由于基于re_path的路径编写方式是重复性高的编写url,如果规则改变了,则对应的要去修改很多url,这样是很不方便的 所以采用Django2.0的path去编写u ...
- 重置浏览器默认样式 normalize.css
1 /*! normalize.css v8.0.1 | MIT License | github.com/necolas/normalize.css */ /* Document ========= ...