2010-03-07 73 views
2

ENV: ubuntu的9.10/ 使用gotdeb源/ PHP版本5.3.1/ 的php5-fpm的安装/nginx的不分析的PHP请求

的php5-FPM正在运行,并通过监听9000端口测试下面

pgrep php5-fpm 
telnet localhost 9000 
然而

2级的命令,如果我在LAN anthor计算机访问,使用此地址

http://192.168.1.103/index.php 

浏览器问我保存这个index.php文件,但如果访问的index.php,一切顺利

启用站点-/默认文件内容 ENV: Ubuntu 9.10的/ 使用gotdeb源/ PHP版本5.3。 1/ 的php5-fpm的安装/

的php5-FPM正在运行,并通过2个命令下面

pgrep php5-fpm 
telnet localhost 9000 
然而

监听9000端口测试,如果我在LAN anthor计算机访问,使用此地址

http://192.168.1.103/index.php 

浏览器问我保存这个index.php文件,但如果访问的index.html,一切顺利

网站启用/默认的文件内容

location ~ \.php$ { 
    fastcgi_pass 127.0.0.1:9000 
    fastcgi_index index.php 
    fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name 
    include fastcgi_params 
} 

回答

1

看来你需要设置您网站的索引。

你可以看到一个完整的例子on nginx's official wiki,但这里的相关部分:

location/{ 
    index index.html index.htm index.php; 
} 

正如你看到的,虚拟主机需要知道它应该处理的index.php访问该网站时,通过它的根目录(即http://domain.com/http://domain.com/site/),没有指定文件。

5

一个常见的错误是,当您的代码使用短打开标记<?而不是<?php,并且它没有在全新安装的php.ini中启用,因此它不会被解析。

要启用它设置short_open_tag=On

0
  1. 我有一个指标:

    location/{ 
        index index.php; 
    } 
    
  2. 我不使用PHP <?标签