2013-07-15 46 views
0

我有nginx.conf到fuelphpnginx重寫模塊不工作?

location/{ 
    if (!-e $request_filename) { 
     rewrite ^(.*)$ index.php?/$1 last; 
    } 
} 

location ~ \.php$ { 
    fastcgi_split_path_info ^(.+\.php)(/.+)$; 
    fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock; 
    fastcgi_index index.php; 
    include  fastcgi.conf; 
    include /etc/nginx/fastcgi_params; 
} 

但這不是testfphp /公/歡迎工作/你好

nginx的說:找不到文件

謝謝。

回答

0

您似乎混合了不同操作方法的不同位,而不理解它們。注意:

rewrite ^(.*)$ index.php?/$1 last; #question mark, typo? 
location ~ \.php$ # matches end of request_uri 
fastcgi_split_path_info ^(.+\.php)(/.+)$; # matches .php followed by a slash 

對於第三條語句來搭配,.php是從來沒有在REQUEST_URI的結束,因此該語句將永遠不會在這個位置匹配。

從第一條語句中刪除問號,從位置中刪除美元符號。然後,添加:

fastcgi_param SCRIPT_FILENAME $document_root$ fastcgi_script_name; 
fastcgi_param PATH_INFO $fastcgi_split_pathinfo; 

到位置塊。嘗試從文檔中瞭解並嘗試進一步限制位置塊。