2014-11-06 119 views
1

我剛剛從開發轉移到生產。我意識到我的路由在生產環境中不起作用。我正在使用LEMP堆棧。Phalcon路由不能在Nginx工作

任何人都可以引導我在正確的方向嗎?

這是我的nginx配置。

server { 

listen 80; 
server_name localhost; 
charset utf-8; 
index index.php index.html index.htm; 
set $root_path '/usr/share/nginx/ppl/public'; 
root $root_path; 

try_files $uri $uri/ @rewrite; 

location @rewrite { 
    rewrite ^/(.*)$ /index.php?_url=/$1; 
} 

location ~ \.php { 
    fastcgi_pass unix:/var/run/php5-fpm.sock; 
    fastcgi_index /index.php; 
    #fastcgi_pass 127.0.0.1:9000; 
    include /etc/nginx/fastcgi_params; 

    fastcgi_split_path_info  ^(.+\.php)(/.+)$; 
    fastcgi_param PATH_INFO  $fastcgi_path_info; 
    fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; 
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; 
} 

location ~* ^/(css|img|js|flv|swf|download)/(.+)$ { 
    root $root_path; 
} 

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

這是我的路由代碼片段。

$di->set('router', function() { $router = new Router(); 

$router->add(
    '/list/([0-9]+)/([a-z0-9\-]+)', 
    array(
     'controller' => 'Listing', 
     'action'  => 'detailed', 
     'id' => 1, 
     'title' => 2 

    ) 
); 
$router->add('/', array(
    'controller' => 'Listing', 
    'action' => 'home' 
)); 

$router->removeExtraSlashes(true); 
return $router; 
},true); 

我能夠通過url訪問控制器和相應的操作。

有什麼重要的,我失蹤了?

謝謝大家。

回答

1

似乎是區分大小寫的問題

在路由代碼片段,改變

上市到上市使得應用工作