Nginx clean-URLs for Drupal installed in various sub-directories

Submitted by fago on Fri, 07/15/2011 - 11:29

klausi has already posted a nice, actually working nginx configuration for Drupal on his blog. This configuration is intended for Drupal installations installed on separate (sub)domains. However, recently I came up with the need of having multiple Drupal installations in sub-directories for my development environment. To achieve that I've created the following location directive:

        location ~ ^/([^/]*)/(.*)$ {
                try_files $uri /$1/index.php?q=$2&$args;

That way, you can just add as many Drupal installations as you want in sub-folders, while they are automatically clean-URL enabled. :)