我正在运行一个带有2个wordpress的ec2服务器(微实例)。它们运行了好几个月但是从2天开始(在yum update
之后)PHP-FPM在每次重新启动后10-15分钟后停止运行。
以下是我的配置文件
/etc/php-fpm.d/www.conf
[www]
listen = /tmp/php5-fpm.sock
listen.allowed_clients = 127.0.0.1
listen.owner = nginx
listen.group = nginx
listen.mode = 0660
user = apache
group = apache
pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 2
pm.max_spare_servers = 10
pm.max_requests = 50
pm.status_path = /status-oRYJC44bRyXXDrJatf8D
ping.path = /ping-Au9jLCjG6F4NiLQDenbG
slowlog = /var/log/php-fpm/www-slow.log
php_admin_value[error_log] = /var/log/php-fpm/www-error.log
php_admin_flag[log_errors] = on
user nginx;
worker_processes 1;
worker_rlimit_nofile 8192;
events {
worker_connections 8000;
}
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
http {
charset utf-8;
include mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
server_tokens off;
keepalive_timeout 20;
sendfile on;
client_max_body_size 32M;
tcp_nopush on; # off may be better for Comet/long-poll stuff
tcp_nodelay off; # on may be better for Comet/long-poll stuff
server_name_in_redirect off;
types_hash_max_size 2048;
gzip on;
gzip_http_version 1.0;
gzip_comp_level 5;
gzip_min_length 512;
gzip_buffers 4 8k;
gzip_proxied any;
gzip_types
text/css
text/plain
text/x-component
application/javascript
application/json
application/xml
application/xhtml+xml
application/x-font-ttf
application/x-font-opentype
application/vnd.ms-fontobject
image/svg+xml
image/x-icon;
gzip_disable "msie6";
gzip_vary on;
upstream php {
server unix:/tmp/php5-fpm.sock;
}
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
网站
server {
listen 80;
server_name *.example.com;
rewrite ^/(.*) http://example.com/$1 permanent;
}
server {
listen 80 default; ## listen for ipv4; this line is default and implied
#listen [::]:80 default ipv6only=on; ## listen for ipv6
listen 443 ssl;
ssl_certificate ssl/example.com.crt;
ssl_certificate_key ssl/example.com.key;
# Make site accessible from http://localhost/ or server IP-address
server_name example.com;
#server_name_in_redirect off;
charset utf-8;
access_log /var/log/nginx/example-access.log;
error_log /var/log/nginx/example-error.log;
set $deny_access off;
if ($uri ~ ^/xmlrpc.php(.*)$ ) {
set $deny_access on;
}
if ($deny_access = on) {
return 503;
}
root /usr/share/nginx/example;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
fastcgi_pass php;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/example$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT /usr/share/nginx/example;
# send bad requests to 404
fastcgi_intercept_errors on;
include fastcgi_params;
}
}
这里有一些日志:
PHP FPM:
[11-Jan-2015 19:28:19] NOTICE: ready to handle connections
[11-Jan-2015 19:33:44] WARNING: [pool www] child 5642 exited on signal 11 (SIGSEGV) after 299.891871 seconds from start
[11-Jan-2015 19:33:44] NOTICE: [pool www] child 5662 started
的/ var /日志/消息
Jan 11 19:33:44 domU-12-31-38-04-82-E0 kernel: [6910404.506902] php-fpm[5642]: segfault at 7fce0000000f ip 00007fcedddf6d78 sp 00007fff40e6bd88 error 6 in apc.so[7fceddde9000+23000]