vps又挂了一下
今天vps又挂了一下,不是502了,直接没有反应,忘了 测试nginx有没有反映了。应该测试一下html文件能不能打开,看这次是php-cgi的问题还是nginx的问题,我直接重启的vps,这样问题就消失了。考虑到问题可能还会再现,所以依然百度了一下问题,这次看别人把logs都贴出来,我也查看一下自己的log文件。
nginx的logs里是四月份的错误,没有这几天的,说明nginx一直运行很好,虽然时不时的出个502,在看php-fpm的log,可不得了,它一直记录着自己的错误,我竟然一直没有看,截一下今天的部分错误
Jun 15 08:54:20.173202 [WARNING] fpm_children_bury(), line 215: child 13876 (pool default) exited on signal 15 SIGTERM after 1501.162766 seconds from start
Jun 15 08:54:20.173240 [WARNING] fpm_children_bury(), line 215: child 13877 (pool default) exited on signal 15 SIGTERM after 1501.161380 seconds from start
Jun 15 08:54:20.173277 [WARNING] fpm_children_bury(), line 215: child 13879 (pool default) exited on signal 15 SIGTERM after 1501.160255 seconds from start
Jun 15 08:54:20.173314 [WARNING] fpm_children_bury(), line 215: child 13880 (pool default) exited on signal 15 SIGTERM after 1501.159244 seconds from start
Jun 15 08:54:20.173624 [WARNING] fpm_children_bury(), line 215: child 13891 (pool default) exited on signal 15 SIGTERM after 1501.143989 seconds from start
Jun 15 08:54:20.173661 [WARNING] fpm_children_bury(), line 215: child 13892 (pool default) exited on signal 15 SIGTERM after 1501.142966 seconds from start
Jun 15 08:54:20.173684 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jun 15 08:54:20.173696 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jun 15 08:54:20.173705 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jun 15 08:54:20.173714 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jun 15 08:54:20.173798 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jun 15 08:54:20.173807 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jun 15 08:54:20.178277 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jun 15 08:54:20.178339 [WARNING] fpm_children_bury(), line 215: child 13885 (pool default) exited on signal 15 SIGTERM after 1501.160037 seconds from start
Jun 15 08:54:20.191719 [NOTICE] fpm_got_signal(), line 48: received SIGCHLD
Jun 15 08:54:20.191802 [WARNING] fpm_children_bury(), line 215: child 13882 (pool default) exited on signal 15 SIGTERM after 1501.175649 seconds from start
Jun 15 08:54:20.191814 [NOTICE] fpm_pctl_exit(), line 81: exiting, bye-bye!
Jun 15 08:54:21.098436 [NOTICE] fpm_unix_init_main(), line 284: getrlimit(nofile): max:51200, cur:51200
Jun 15 08:54:21.098660 [NOTICE] fpm_event_init_main(), line 88: libevent: using epoll
Jun 15 08:54:21.098735 [NOTICE] fpm_init(), line 52: fpm is running, pid 19936
Jun 15 08:54:21.113242 [NOTICE] fpm_children_make(), line 352: child 19937 (pool default) started
Jun 15 08:54:21.114894 [NOTICE] fpm_children_make(), line 352: child 19938 (pool default) started
Jun 15 08:54:21.116288 [NOTICE] fpm_children_make(), line 352: child 19939 (pool default) started
Jun 15 08:54:21.117592 [NOTICE] fpm_children_make(), line 352: child 19940 (pool default) started
Jun 15 08:54:21.133599 [NOTICE] fpm_children_make(), line 352: child 19952 (pool default) started
Jun 15 08:54:21.134687 [NOTICE] fpm_children_make(), line 352: child 19953 (pool default) started
Jun 15 08:54:21.135713 [NOTICE] fpm_children_make(), line 352: child 19954 (pool default) started
Jun 15 08:54:21.135747 [NOTICE] fpm_event_loop(), line 107: libevent: entering main loop
参考了网上的内容,修改了一下东西,可是我基本上都已经做过了,
比如张宴的方法(加进程,加FastCGI的timeout时间)、做均衡等等,我在这儿http://www.5169.info/software/lnmp/ru-is-how-to-analyze-the-nginx-php-fpm-for-502-errors.html已经写过了
昨天新加进去的东西
ulimit –n
查看php打开文件数的限制,昨天修改的时候是1024,怎么会那么少呢?
打开/usr/local/webserver/php/etc/php-fpm.conf
vi /usr/local/webserver/php/etc/php-fpm.conf
修改
<value name="rlimit_files">65535</value>
其实我改为51200了,记得哪儿达不到65535 , 51200比较保险点吧
打开/etc/security/limits.conf
vi /etc/security/limits.conf
加上
* soft nofile 51200
* hard nofile 51200
这儿限制一个进程能打开多少个文件(/etc/sysctl.conf 文件中的fs.file-max=XXX 限制系统一共能打开多少个文件 )
最后我还发现我的php-fpm.conf中 request_terminate_timeout 是900s,当初怎么想的,好想这样改了以后,502少了
ulimit -SHn 51200
/usr/local/webserver/php/sbin/php-fpm restart
查看文件打开限制
ulimit –n
显示51200
重启php-fpm,不过我感觉不出来是否变好了,等时间的验证吧
版权声明:
作者:xinyu2ru
链接:https://www.rxx0.com/software/lnmp/vps-then-hung-up-about.html
来源:RUBLOG-分享我的生活
文章版权归作者所有,未经允许请勿转载。
共有 1 条评论