Complex url rewriting

lmauldinpe15 nginx-forum at nginx.us
Mon Nov 23 20:34:33 UTC 2015


Did you mean to use nested location blocks?  I tried it but it didn't work. 
Here is the relevant part of my configuration file:

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

    location /index.php {
        location ~* (?:.*/index.php)(.*) {
            fastcgi_param SCRIPT_FILENAME $document_root$1;
            fastcgi_pass   unix:/var/run/php5-fpm.sock;
            include        fastcgi_params;
        }
    }

    location / {
        try_files $uri $uri/ =404;
    }
    location ~ \.php$ {
        fastcgi_pass   unix:/var/run/php5-fpm.sock;
        try_files $uri =404;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include        fastcgi_params;
    }

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



More information about the nginx mailing list