[PATCH] implement a $location variable

António P. P. Almeida appa at perusio.net
Fri Jan 4 11:06:56 UTC 2013

On 4 Jan 2013 11h35 CET, david at gwynne.id.au wrote:

> On 04/01/2013, at 7:04 PM, António P. P. Almeida <appa at perusio.net>
> wrote:
>> On 4 Jan 2013 03h18 CET, david at gwynne.id.au wrote:
>>> need is a strong work, its just a lot nicer.
>>>> Have you each site installed in a subdir? Is that the case?
>>> no. it is a single copy of the drupal codebase which is shared by
>>> all the sites, they just have separate settings.php files. the way
>>> nginx tells drupal which settings to use is via SCRIPT_NAME based
>>> on $location.
>> Ok. If I understood correctly you have a typical multi-site
>> setup. Why are you doing the host resolution at the server level?
>> Drupal does it at the application level. It's capable of handling
>> all hosts for which the vhost is configured to support.
>> See:
>> http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/conf_path/7
> that makes it look like i can pass $request_uri as
> SCRIPT_NAME. however, while drupal does get the right site
> settings.php file doing that, for some reason it cant figure out
> which page its on. it either generates a 404 or only shows the home
> page no matter what uri i give it in a web browser.

That should work out of the box without any "tinkering".

<shameless plug>
Here's a Drupal config that works with multisites as designed:

Also there's a Drupal group for Nginx:


> while i do take the point that there are other ways of making drupal
> do what i want with and unpatched nginx, that doesnt mean other
> things couldnt make good use of a $location variable.

Sure. You have to sell the idea to the Nginx devs. 

--- appa

More information about the nginx-devel mailing list