Author: admin | Category: Apache, PHP
Comments: 评论关闭

这个问题实在好怪,折腾了的一个多月。
情况是这样的:

新配了一台服务器,全新 RedHat 5.4 X64 的OS ,Intel 5500系列的CPU
Apache 2.2.14  + PHP 5.2.6 + Zend 3.3.x + eaccelerator 0.9.4

每到了一段时间,八核CPU就会有2核 始终恒定在 100% 占用进程是 httpd 即 apache
由于还有其他6核的资源,所以访问没有任何影响。
找了好久原因,一度怀疑是 mod_mpm 的问题,调整了无数次参数。
后来由于流量越来越高,出现的频率越来越频繁,差不多2天就又变成这样了。
查看 error_log 看到不断有提示:

child pid ***** exit signal Segmentation fault (11)
child pid ***** exit signal Segmentation fault (11)
child pid ***** exit signal Segmentation fault (11)

重启 Apache 的时候还更会一堆过来。
好不容易找到原因,原来是因为 PHP 加速器 eaccelerator 0.9.4 跟 As5.4 X64 内核的兼容有问题。
之前在 As5.3 X64 上是完全正常的

于是下载了最新的 eaccelerator V0.9.6
重新编译 eaccelerator 升级覆盖,问题解决!

Author: admin | Category: Nginx
Comments: 评论关闭

nginx的geo模块可以做全局负载均衡,可以要根据客户端ip访问到不同的server。比如,可以将电信的用户访问定向到电信服务器,网通的用户重定向到网通服务器。
我这里实现只有移动手机用户才能访问服务器。首先要收集全移动网关ip.
配置如下:

worker_processes 1;
events {
        worker_connections 1024;
}

http {
        include         mime.types;
        default_type    application/octet-stream;
        sendfile        on;
        keepalive_timeout 65;
        geo $cmccip {
                default 1;   # 未定义ip的值为1
                include cmcc.conf; 加载geo.conf文件,这个文件定义移动网关ip
        }
        server {
                listen 801;
                server_name XXXXX;
                location / {
                        if ($cmccip) {
                                rewrite ^ http://tx.com.cn;   未定义ip即非移动ip重定向到tx.com.cn;
                        }
                        root /data/www;
                        index index.wml index.html;

                }
        }
}

cmcc.conf文件内容如下:
211.136.222.90/32 0;

Top
RSS for entries