【问题标题】:Phalcon Routing not working in NginxPhalcon 路由在 Nginx 中不起作用
【发布时间】:2014-11-06 12:47:15
【问题描述】:

我刚从开发转到生产。我意识到我的路由在生产环境中不起作用。我正在使用 LEMP 堆栈。

谁能指引我正确的方向?

这是我的 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;
}
}

这是我的路由代码sn-p。

$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 访问控制器和相应的操作。

我错过了什么重要的事情吗?

谢谢大家。

【问题讨论】:

    标签: phalcon phalcon-routing


    【解决方案1】:

    好像是区分大小写的问题

    在路由代码sn-p中,改了

    列表到列表使应用程序正常工作

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-06-12
      • 2021-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多