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

gigabyte nginx-forum at nginx.us
Fri Jan 6 12:26:08 UTC 2012


Here is my full config
server {

    set $sroot /services/www/site;

    listen      192.168.170.1:80;
    server_name  site.net www.site.net;
    access_log  /var/log/nginx/site.net.access.log  main;
    error_log  /var/log/nginx/site.net.error.log info;

    location = /administrator {
        root $sroot/administrator;
    }

    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 ~ \.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;
    }
}

Edho Arief Wrote:
-------------------------------------------------------
> On Fri, Jan 6, 2012 at 6:39 PM, gigabyte
> <nginx-forum at nginx.us> wrote:
> > I've already tried meny variations including
> this one. In fact I'm using
> > it right now with some modifications:
> >
> 
> Post the full config.

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



More information about the nginx mailing list