首页 > php教程 > php手册 > 正文

fast-cgi 启动了,但是 nginx 无法执行 php

php中文网
发布: 2016-06-06 20:10:11
原创
1480人浏览过

我用的是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;
登录后复制

求各位大神指点。小弟感激不尽

Brev AI
Brev AI

Brev.ai:搭载Suno AI V3.5技术的免费AI音乐生成器

Brev AI 437
查看详情 Brev AI
相关标签:
PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号