2013-07-06 24 views
3

我想在本地機器(Win8x64)上設置Zurmo CRM。安裝完所有要求後,我想開始實際安裝。問題在於,似乎路徑沒有從NGinx正確傳遞到FastCGI PHP。這裏是我的Nginx的服務配置:如何正確配置Nginx的PHP(Yii框架和Zurmo)

server { 

    listen  80; 
    server_name zurmo.local; 
    root   html/zurmo.local; 
    set $index "index.php"; 

    charset utf-8; 

    location/{ 
     index index.html $index; 
     try_files $uri $uri/ /$index?$args; 
    } 

    location ~ ^/(protected|framework|themes/\w+/views) { 
     deny all; 
    } 

    location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { 
     try_files $uri =404; 
    } 

    location ~ \.php { 

     fastcgi_split_path_info ^(.+\.php)(.*)$; 

     set $fsn /$index; 
     if (-f $document_root$fastcgi_script_name){ 
      set $fsn $fastcgi_script_name; 
     } 

     fastcgi_pass 127.0.0.1:9000; 
     include fastcgi_params; 
     fastcgi_param SCRIPT_FILENAME $document_root$fsn; 
     fastcgi_param PATH_INFO  $fastcgi_path_info; 
     fastcgi_param PATH_TRANSLATED $document_root$fsn; 
    } 

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

其結果是,當我撥打電話到zurmo.local(被添加到hosts文件)我得到「此網頁有重定向循環」使用URI看起來這樣http://zurmo.local/app/app/ [...] /app/app/index.php如果代替$document_root$fsn和我評論的PATH_INFOPATH_TRANSLATED比我得到No input file specified.一個URI看起來像http://zurmo.local/app/app/index.php

進一步尋找到它,當我加入access_log html/zurmo.local/logs/access.log; Nginx的error.log讓我看到以下內容:[timestamp] [emerg] 4064#3660: CreateFile() "[path to stack]\nginx/html/zurmo.local/logs/access.log" failed (3: The system cannot find the path specified)。正如你所看到的,目錄分隔符不一致。

最後一個註釋,我的Nginx主目錄位於nginx/html這實際上是一個連接到../home這純粹是爲了保持我的文件結構適合我的日常工作。

如何正確配置Nginx才能繼續(使用Zurmo安裝)?

回答

0

我不認爲你需要在*.php塊中的if()聲明。在我的nginx的設置這一切我所需要的:

# Process PHP files 
location ~ \.php$ { 
    fastcgi_split_path_info ^(.+\.php)(/.+)$; 

    # Include the standard fastcgi_params file included with nginx 
    include fastcgi_params; 

    fastcgi_param PATH_INFO  $fastcgi_path_info; 
    fastcgi_index index.php; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 

    fastcgi_pass 127.0.0.1:9000; 
} 
+0

似乎我在這裏得到重定向:'/ app/app/index.php',具有相同的結果'沒有指定輸入文件。'問題可能來自其他地方嗎? – jimasun

2

我知道這是一個老問題,但這裏是我做了什麼做出的nginx + zurmo工作。

server { 
    listen  80; 
    server_name zurmo.local; 
    root   /home/www/zurmo.local; 
    access_log /var/log/nginx/zurmo.access.log main; 
    index index.php; 

    location/{ 
     try_files $uri $uri/ /index.php?$args; 
    } 

    location ~ ^/(protected|framework|themes/\w+/views) { deny all; } 
    location ~ /\. { deny all; access_log off; log_not_found off; } 
    location = /favicon.ico { log_not_found off; access_log off; } 
    location ~ \.(js|css|png|jpg|gif|ico|pdf|zip|rar)$ { 
     try_files $uri =404; 
    } 

    location ~ \.php { 
     fastcgi_split_path_info ^(.+\.php)(.*)$; 

     fastcgi_param PATH_INFO  $fastcgi_path_info; 
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
     include fastcgi_params; 

     fastcgi_pass 127.0.0.1:9000; 
     fastcgi_index index.php; 

     fastcgi_read_timeout 600s; 
     fastcgi_send_timeout 600s; 
    } 
}