Complex url rewriting

lmauldinpe15 nginx-forum at nginx.us
Tue Nov 24 22:53:22 UTC 2015


I think this seems to be working for now.  Does anyone see a problem with
it:

   # define web root
    root   /var/www/html/public;
    index  index.php default.php index.html;

    location / {
        try_files $uri $uri/ =404;
    }

    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+?\.php)(/.*)$;

        # Save the $fastcgi_path_info before try_files clear it
        set $path_info $fastcgi_path_info;
        fastcgi_param PATH_INFO $path_info;
        try_files $fastcgi_script_name =404;

        fastcgi_pass   unix:/var/run/php5-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,263024,263065#msg-263065



More information about the nginx mailing list