Questions about Internal named location

Igor Sysoev igor at sysoev.ru
Fri Jul 30 23:47:09 MSD 2010


On Fri, Jul 30, 2010 at 09:26:42PM +0200, Rob Schultz wrote:

> > This all started when I tried to setup one nginx server that has
> > multiple php sites under one url that needs a alias for the other sites.
> > Something like this:
> > 
> > root /var/www/somesite;
> > 
> > location / {
> >    index.html index.php;
> > }
> > location /wordpress {
> >    alias /var/www/wordpress;
> >    try_files $uri $uri/ @wordpress;
> > }
> > .... 
> 
> from the wiki http://wiki.nginx.org/Wordpress
> might try this format
> location /wordpress {
>   try_files $uri $uri/ /wordpress/index.php?q=$uri&args;
> }
> 
> and then have your normal php location block for fastcgi settings. 

It's better to set a script name and a query string directly in
fastcgi_param to avoid surplus copy operations:

location /wordpress {
    root  /var/www;
    try_files $uri $uri/ @wordpress;
}

location @wordpress {
    ...
    fastcgi_param   SCRIPT_FILENAME /var/www/wordpress/index.php;
    fastcgi_param   QUERY_STRING    q=$uri&$args;
}


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list