Dash in request url messes up regex?

Christ-Jan Wijtmans cj.wijtmans at gmail.com
Fri Jun 26 08:46:35 UTC 2015


I am requesting the url /magento-check.php and it gives me the php
code instead of running it through fpm. Other php files work just
fine. Seems like the dash is screwing with the php regex location and
going through root location with try_files, serving the php code.

        location ~* \.php(/.*)?$
        {
                if (!-e $request_filename) { return 404; }

                fastcgi_pass            unix:/var/run/php-fpm/blah.sock;
                fastcgi_split_path_info ^(.*\.php)(/.*)?$;
                include                 fastcgi.conf;

                expires off;
        }

        location /
        {
                try_files $uri $uri/ =404;
                expires 28d;
        }


Live long and prosper,

Christ-Jan Wijtmans
https://github.com/cjwijtmans
http://facebook.com/cj.wijtmans
http://twitter.com/cjwijtmans



More information about the nginx mailing list