我用的是ubuntu12.04,php是5.2.10然后用的spawn-fcgi。top里面能看到php5-cgi启动起来了,访问html没问题,我用nginx upstream转发到apache(8080端口)也能执行php程序,就是fastcgi有问题。网页提示502,日志 connect() failed (111: Connection refused)
我用的是ubuntu12.04,php是5.2.10然后用的spawn-fcgi。top里面能看到php5-cgi启动起来了,访问html没问题,我用nginx upstream转发到apache(8080端口)也能执行php程序,就是fastcgi有问题。网页提示502,日志
connect() failed (111: Connection refused) while connecting to upstream, client: 123.151.148.160, server: new.cdfdc.gov.cn, request: "GET /archive.php?addno=8&aid=120&ccid12=3032&ccid5=184&ccid6=188&fang=zhu&sort=mj:1 HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "new.cdfdc.gov.cn", referrer: "http://new.cdfdc.gov.cn/"
服务器内存什么的消耗都很低,基本上不会是资源不足问题。另外fastcgi进程使用数也远远没有达到我的设定的进程数目
我的网站配置
server {
listen 80;
server_name fdcsck.com www.fdcsck.com;
# handling 404 error for root error_page 404 /index.html; access_log /var/log/nginx/access.log; error_log /var/log/nginx/sck_error.log; location / { root /var/www/fdcsck; index index.php index.html index.htm; } location ~ \.php$ { include fastcgi_params; fastcgi_pass 127.0.0.1:9000; #fastcgi_pass unix:/var/run/php-fastcgi/php-fastcgi.socket; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/fdcsck$fastcgi_script_name; }
nginx 配置
user www-data;
worker_processes 2;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
##
# Basic Settings
##
sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; client_max_body_size 100m; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream;
求各位大神指点。小弟感激不尽
原文地址:fast-cgi 启动了,但是 nginx 无法执行 php, 感谢原作者分享。