1
votes

I'm working on building a website using MAMP + nginx + phalcon. I have everything set up and phalcon is working, but it only sees the IndexController and the indexAction. If I add more controllers and try to navigate to them I get a 404 error. Also if I add another action to the IndexController I can not get to it and I get a 404 error again. Here is my nginx config file:

    server {
    listen               7888 default_server;

    root                 "/dev/testing/public";

    location / {
        index            index.html index.php;
    }

    location ~ \.php$ {
        try_files        $uri =404;
        fastcgi_pass     unix:/Applications/MAMP/Library/logs/fastcgi/nginxFastCGI.sock;
        fastcgi_param    SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include          fastcgi_params;
    }
}

My index.php is the same as the given index in the phalcon documentation. Any advice/insights would be greatly appreciated.

2

2 Answers

1
votes

Your nginx conf should point all requests to your bootstrap file (usually your index.phpin your public folder) passing the _url param containing the original path requested.

That's how the Phalcon router works out of box.

The right configuration block may vary depending on your project's file structure. So you'll need to read Phalcon's Nginx Installation Notes to see which configurations are needed to your particular situation.

0
votes

Try to check the documentation of phalcon nginx here https://docs.phalconphp.com/en/latest/reference/nginx.html, I was able to use that kind of configuration because we're passing _url param