Source

Nginx Vhost / .skel / vhost-default / conf / apps / moodle.conf

        location /
        {
                # If the file exists as a static file serve it
                # directly without running all
                # the other rewite tests on it
                if ($request_filename ~ "favicon\.ico$") {
                        break;
                }

                if (-e $request_filename) {
                        expires 30d;
                        break;
                }

                # If file isn't found
                if (!-e $request_filename) {
                        set $filephp 1;
                }

                # If the missing file is a php folder URL
                if ($request_filename ~ "\.php/") {
                        set $filephp "${filephp}1";
                }

                # Non-existing URL based on PHP script
                # Rewrite the URL to the base PHP script requesting
                if ($filephp = 11) {
                        rewrite  ^(.*)\.php/.*$  /$1.php  last;
                        break;
                }

                #if ($filephp = 1) {
                #       break;
                #}
        }