How to remove the "IF" in this fcgi config

Ed W lists at
Thu Feb 21 17:48:21 UTC 2013

Hi, I'm trying to setup a php app using fpm (owncloud).

I am trying to match urls which can all over the filesystem and of the 
form: something.php/some/path?params

So far I have something like this:

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

                 location ~ ^(?P<script_name>.+\.php)(/|$) {
                         fastcgi_split_path_info ^(.+\.php)(/.*)$;
                         if (!-f $script_name) {
                                 #return 404;
                         include fastcgi2.conf;

fastcgi2.conf is a copy of fastcgi.conf with one change:
fastcgi_param  REQUEST_URI        $uri$is_args$args;

How do I avoid using an IF here to check that the php file really 
exists?  Also, why does uncommenting the return 404 cause some kind of 
breakage (not even sure I understand exactly what happens? Seems like 
the paths get broken?)

Thanks for any help?

Ed W

More information about the nginx mailing list