【问题标题】:Phalcon route not working, all urls access indexPhalcon 路由不起作用,所有 url 访问索引
【发布时间】:2017-04-15 12:11:28
【问题描述】:

我使用 phalcon-dev-tools-v2.0.13 创建了一个名为 test 的项目,我访问了根 url "/",它成功了!然后,我更改了一些代码,如下所示:

成功了!

但是:

我又加了一个网址,还是不行!

怎么了?我是 Phalcon 的新手,我关注了 Phalcon 的文档。 我的系统是php5.6.30Phalcon2.0.13nginx的conf文件是:

server {
             listen      80;
             server_name test;
             root /Users/ryugou/test/public;
             index  index.php index.html index.htm;
             charset     utf-8;

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

    location ~ \.php$ {
         try_files     $uri =404;

         fastcgi_pass  127.0.0.1:9000;
         fastcgi_index /index.php;

         include 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 ~ /\.ht {
         deny all;
     }
}

【问题讨论】:

  • 你是如何配置你的 Phalcon 路由的?
  • 不,我没有。这只是 Phalcon-dev-tools-v2.13 的一个例子。

标签: phalcon phalcon-routing


【解决方案1】:

您的问题出在 nginx 配置文件上。您没有在位置块上传递 _url -

将位置块修改为(小心最后一部分)-

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

检查Phalcon Nginx Config

【讨论】:

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