Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] implement a $location variable

António P. P. Almeida
January 03, 2013 09:12PM
On 4 Jan 2013 02h58 CET, appa@perusio.net wrote:

> On 4 Jan 2013 02h22 CET, david@gwynne.id.au wrote:
>
>> here's a diff that provides $location for use in not regex location
>> blocks.
>>
>> we're using it to provide easy to use mass hosting of drupals:
>>
>> xdlg@argon nginx$ cat drupal-controller.conf
>> root /var/www/apps/drupal;
>> try_files /index.php =404;
>> include fastcgi_params;
>> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
>> fastcgi_param SCRIPT_NAME $location$fastcgi_script_name;
>> fastcgi_intercept_errors on;
>> fastcgi_pass localhost:9000;
>>
>> which is used in server blocks like this:
>>
>> server {
>> listen 80;
>> server_name www.example.com;
>>
>> location / { include drupal-controller.conf; }
>> location /foo { include drupal-controller.conf; }
>> location /bar { include drupal-controller.conf; }
>> location /baz { include drupal-controller.conf; }
>> }
>>
>> i cannot otherwise find a nice way to use the locations name as a
>> parameter without specifying the value as a variable again within
>> the location.
>
> I fail to see the need for a $location variable in a Drupal Nginx
> config. Can you elaborate why? The multiple inclusion is only needed
> if you redefine any of the fastcgi_param(s) in each location.
>
> Have you each site installed in a subdir? Is that the case?
>
>
> I think this will probably work in your case:
>
> location ~ ^(<current_location_base>[^/]*)/.*$ { include
> drupal-controller.conf; fastcgi_param SCRIPT_NAME
> $current_location_base/$fastcgi_script_name; }

Oops. Wrong regex. Rather:

location / {
include drupal-controller.conf;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;

location ~ ^(/(<current_location_base>[^/]*).*$ {
include drupal-controller.conf;
fastcgi_param SCRIPT_NAME $current_location_base$fastcgi_script_name;
}
}

--- appa

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] implement a $location variable

David Gwynne 1291 October 14, 2012 09:24PM

Re: [PATCH] implement a $location variable

Maxim Dounin 535 October 15, 2012 10:54AM

Re: [PATCH] implement a $location variable

David Gwynne 590 October 16, 2012 09:18AM

Re: [PATCH] implement a $location variable

Maxim Dounin 574 October 16, 2012 10:48AM

Re: [PATCH] implement a $location variable

David Gwynne 584 October 16, 2012 07:44PM

Re: [PATCH] implement a $location variable

David Gwynne 447 January 03, 2013 08:24PM

Re: [PATCH] implement a $location variable

António P. P. Almeida 431 January 03, 2013 09:00PM

Re: [PATCH] implement a $location variable

António P. P. Almeida 461 January 03, 2013 09:12PM

Re: [PATCH] implement a $location variable

David Gwynne 411 January 03, 2013 09:20PM

Re: [PATCH] implement a $location variable

António P. P. Almeida 485 January 04, 2013 04:06AM

Re: [PATCH] implement a $location variable

David Gwynne 462 January 04, 2013 05:36AM

Re: [PATCH] implement a $location variable

António P. P. Almeida 666 January 04, 2013 06:08AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 81
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready