天,
我正在运行一个带有 Nginx (1.2.7_1,1) 和 PHP-FPM (5.4.12) 的 FreeBSD 盒子 (9.1-RELEASE)。我在使用 Apache AB 处理并发请求时遇到了很大的问题:
ab -n 10000 -c 500 http://10.128.28.164/index.php
我在 /var/log/httpd-error.log (成千上万)中得到的主要错误是:
2013/03/08 11:11:10 [错误] 99855#0: *44116 kevent() 报告 connect() 在连接到上游时失败(54:对等方重置连接),客户端:10.128.28.179,服务器:本地主机,请求:“GET /index.php HTTP/1.0”,上游:“fastcgi://10.128.28.164:9000”,主机:“10.128.28.164”
如果我浏览到服务器 (10.128.28.164),它适用于 HTML 和 PHP 页面。
任何帮助都会很棒!
皮特。
我的 php-fpm.conf 文件如下所示:
pid = run/php-fpm.pid
error_log = log/php-fpm.log
daemonize = yes
events.mechanism = kqueue
; Pool
[www]
user = www
group = www
listen = 10.128.28.164:9000
pm = dynamic
pm.max_children = 100
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 100
我的 nginx.conf 文件如下所示:
worker_processes 4;
error_log /var/log/httpd-error.log;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /var/log/httpd-access.log;
sendfile on;
keepalive_timeout 65;
gzip on;
server {
listen 10.128.28.164:80;
server_name localhost;
root /usr/local/www;
location ~ \.php$ {
fastcgi_pass 10.128.28.164:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_script_name;
include fastcgi_params;
}
location / {
index index.html;
}
}
}