Re: why my php file in subdirectory doesn't work?

gigabyte nginx-forum at nginx.us
Fri Jan 6 11:39:17 UTC 2012


I've already tried meny variations including this one. In fact I'm using
it right now with some modifications:

    location / {
        root $sroot;
        index  index.php index.html index.htm;
        if (-e $request_filename) {
            break;
        }
        rewrite ^/(.+)$ /index.php?q=$1 last;
    }
     if ($host !~* ^www\.) {
        rewrite ^(.*)$ http://www.$host$1 permanent;
    }

    location = /administrator {
        rewrite ^ $uri/?$args permanent;
    }

    location ~ \.php$ {
        root $sroot;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index  index.php;
        fastcgi_param  SCRIPT_FILENAME 
$document_root$fastcgi_script_name;
        include        /usr/local/etc/nginx/fastcgi_params;
    }

    location ~ /\.ht {
        deny  all;
    }

But it keeps redirecting me to document_root instead of
document_root/subdirectory

Also I know that It worked before some one put his hands on my config
files.

hobson42 Wrote:
-------------------------------------------------------
> On 06/01/2012 07:37, gigabyte wrote:
> >         fastcgi_param SCRIPT_FILENAME
> $sroot/$fastcgi_script_name ;
> I suspect this should be
> 
>    fastcgi_param SCRIPT_FILENAME
> $document_root$fastcgi_script_name;
> 
> 
> Regards
> 
> Ian
> 
> -- 
> Ian Hobson
> 31 Sheerwater, Northampton NN3 5HU,
> Tel: 01604 513875
> Preparing eBooks for Kindle and ePub to give the
> best reader experience.
> 
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,215921,220872#msg-220872



More information about the nginx mailing list