Phalcon和Nginx-框架仅运行indexController [英] Phalcon and nginx - framework run only indexController

查看:112
本文介绍了Phalcon和Nginx-框架仅运行indexController的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Phalcon和Nginx,但我遇到了问题. 当我转到 http://myapp.dev/segmentation 时,Phalcon应该运行SegmentationController及其indexAction()方法.但相反,Phalcon运行的是IndexController("/"的默认控制器).我认为Nginx配置存在问题,因为在Apache下一切正常.

I am using Phalcon and Nginx, and i have a problem. When I go to http://myapp.dev/segmentation Phalcon should run SegmentationController and its indexAction() method. But instead, Phalcon is running IndexController(default controller for "/"). I think problem is with Nginx configuration, because all works fine under Apache.

这是我的Nginx站点配置:

Here is my Nginx site configuration:

server {

    listen   80;
    server_name myapp.dev;

    index index.php index.html index.htm;
    set $root_path '/var/www/myapp/public';
    root $root_path;

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

    location ~ \.php$ {

        try_files $uri $uri/ =404;

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

        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
    }

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

    location ~ /\.ht {
        deny all;
    }

    location /phpmyadmin {

       root /usr/share/;
       index index.php index.html index.htm;

       location ~ ^/phpmyadmin/(.+\.php)$ {

            try_files $uri $uri/ =404;
            fastcgi_split_path_info ^(.+\.php)(/.+)$;

            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index index.php;
            include fastcgi_params;
       }

       location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
         root /usr/share/;
       }

     }
}

推荐答案

使用此配置

try_files $uri $uri/ @rewrite;

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

工作配置

这篇关于Phalcon和Nginx-框架仅运行indexController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆