2014-10-02 60 views
4

这是nginx的我的error.log:另一个FastCGI的主要脚本未知错误(nginx的,PHP5-FPM)

2014年10月2日14时51分29秒[错误] 15936#0:* 1读取stderr中的FastCGI:读取来自上游的客户端响应标题“主要脚本未知”,客户端:134.106.87.55,server:sumomo.shitteru2.net,请求:“GET /index.php HTTP/1.1”,上游:“fastcgi: //unix:/var/run/php5-fpm.sock:”主持人: “sumomo.shitteru2.net”

这是我启用的网站:

server { 
    listen 80; 
    server_name sumomo.shitteru2.net; 

    index index.php index.html index.htm; 

    location/{ 
      root /mnt/firstsite; 
    } 

    location ~ [^/]\.php(/|$) { 
      fastcgi_split_path_info ^(.+?\.php)(/.*)$; 
      if (!-f $document_root$fastcgi_script_name) { 
        return 404; 
      } 
      fastcgi_pass unix:/var/run/php5-fpm.sock; 
      fastcgi_index index.php; 
      include fastcgi_params; 
    } 
} 

据我所见,一切都非常简单,所以它应该工作。我甚至直接从http://wiki.nginx.org/PHPFcgiExample#Connecting_nginx_to_PHP_FPM复制它。你们看到任何潜在的问题吗?

+1

乘坐看看这个http://serverfault.com/questions/517190/nginx-1-fastcgi-sent-in-stderr-primary-script-unknown – mschuett 2014-10-02 15:18:12

回答

0

我做了一个解决方案,我可以在/etc/nginx/snippets/common.conf使用无处不在:

index index.php index.html index.htm index.nginx-debian.html; 
location ~ \.php$ 
{                     
    include snippets/fastcgi-php.conf;                      
    # With php5-fpm:                           
    fastcgi_pass unix:/var/run/php5-fpm.sock;  
} 

现在我所有的站点配置文件看起来很简单:

server { 
    listen 80; 
    listen [::]:80; 

    server_name do-it-big.com www.do-it-big.com; 
    root /var/www/doitbig; 
    client_max_body_size 10m; 
    include snippets/common.conf; 
    location/{ 
     try_files $uri $uri/ /index.php?$args; 
    } 
}