免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5152 | 回复: 2
打印 上一主题 下一主题

[Web] Nginx 启动以后,无法解析PHP。浏览器里面输出:No input file specified. [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2008-11-30 15:09 |只看该作者 |倒序浏览
我的nginx安装完成以后,启动了php-cgi
/usr/local/nginx/conf# /usr/local/nginx/sbin/spawn-fcgi -f /usr/local/php5/bin/php-cgi -a 127.0.0.1 -p 10005 -u lighttpd -g lighttpd
spawn-fcgi.c.206: child spawned successfully: PID: 19688


ps auxww | grep cgi
lighttpd 19688  0.0  0.2  19096  4636 ?        Ss   14:56   0:00 /usr/local/php5/bin/php-cgi
lighttpd 19689  0.0  0.1  19096  2620 ?        S    14:56   0:00 /usr/local/php5/bin/php-cgi
lighttpd 19690  0.0  0.1  19096  2620 ?        S    14:56   0:00 /usr/local/php5/bin/php-cgi
lighttpd 19691  0.0  0.1  19096  2620 ?        S    14:56   0:00 /usr/local/php5/bin/php-cgi
lighttpd 19692  0.0  0.1  19096  2620 ?        S    14:56   0:00 /usr/local/php5/bin/php-cgi
lighttpd 19693  0.0  0.1  19096  2620 ?        S    14:56   0:00 /usr/local/php5/bin/php-cgi


然后启动nginx:
/usr/local/nginx/sbin/nginx

ps auxww | grep nginx
root     19454  0.0  0.0   3024   640 pts/2    S+   14:51   0:00 tail -f /usr/local/nginx/logs/error.log
root     20009  0.0  0.0   2812   496 ?        Ss   15:03   0:00 nginx: master process /usr/local/nginx/sbin/nginx
lighttpd 20010  0.0  0.0   3352  1280 ?        S    15:03   0:00 nginx: worker process      
lighttpd 20011  0.0  0.0   2984   912 ?        S    15:03   0:00 nginx: worker process      
lighttpd 20012  0.0  0.0   2984   912 ?        S    15:03   0:00 nginx: worker process      
lighttpd 20013  0.0  0.0   2984   912 ?        S    15:03   0:00 nginx: worker process      
lighttpd 20014  0.0  0.0   2984   912 ?        S    15:03   0:00 nginx: worker process  


我的nginx.conf如下:

user  lighttpd lighttpd;
worker_processes  5;

error_log  logs/error.log;
pid        logs/nginx.pid;

events {
    worker_connections  1024;
}


http {
    include       mime.types;
    include       /etc/nginx/fastcgi.conf;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] $request '
                      '"$status" $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;

    sendfile        on;
    tcp_nopush     on;
    keepalive_timeout  65;

    gzip  on;

    server {
        listen       80;
        server_name  localhost;

        charset utf-8;

        access_log  logs/host.access.log  main;

        location / {
            root   /home/webroot;
            index  index.php;
        }

        error_page  404              /404.html;

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        location ~ \.php$ {
            fastcgi_pass   127.0.0.1:10005;
        }

        location ~ /\.ht {
            deny  all;
        }
    }
}

然后,我在/home/webroot下建立了一个php文件index.php,
<?php
echo "welcome";
?>


浏览器里面输入:
http://localhost/

浏览器输出:
No input file specified.


有人知道哪个地方错了么?

论坛徽章:
1
技术图书徽章
日期:2013-12-05 23:25:45
2 [报告]
发表于 2008-11-30 23:30 |只看该作者
至少:
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

论坛徽章:
0
3 [报告]
发表于 2008-12-01 15:02 |只看该作者
如果有了fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;

将root   /home/webroot;
移到外部,或者移到location ~ \.php$
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP