How to stop Nginx sending static file requests to the CakePHP app controller when running Cake in a subdirectory?

Posted by robotmay on Server Fault See other posts from Server Fault or by robotmay
Published on 2009-10-12T11:28:01Z Indexed on 2012/06/10 16:42 UTC
Read the original article Hit count: 145

Filed under:
|
|
|

I'm trying to run a CakePHP app from within a subfolder on Nginx, but the static files are not being found and are instead being passed to the app controller. Here's my current config:

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

        if (-f $request_filename) {
            break;
        }

        if (!-e $request_filename) {
            rewrite ^/uniquetv(.+)$ /uniquetv/webroot/$1 last;
            break;
        }
    }                                        

    location /uniquetv/webroot {
        index index.php;

        if (!-e $request_filename) {
            rewrite ^/uniquetv/webroot/(.+)$ /uniquetv/webroot/index.php?url=$1 last;
            break;
        }
    }

Any ideas? :)

© Server Fault or respective owner

Related posts about php

Related posts about nginx