There is absolutely no problem to have multi sites, where:

  • domain1.com points to site A
  • domain2.com points to site B

But I want to have multi-site setup, where:

  • domain1.com points to site A
  • domain1.com/blabla points to site B

I was doing everything to solve it, for example using directory structure like that:

  • domain1.com
  • domain1.com.blabla

or using file sites.php with content:

$sites = array(
'domain1.com' => 'domain1.com',
'domain1.com' => 'domain1.com.blabla',

Nothing works, site 'domain1.com' takes all traffic.


  • I'm using nginx.
  • I'm using Drupal 7.
  • I do not want to use the module Domain as I want to have separated databases.

Please help!

1 Answer 1


I have done this before. Given a generic location / { ... } entry for Nginx which serves domain1.com to make the subdirectory install work I did the following 2 steps. I am not aware of a solution that doesn't involve making a symlink.

Step 1:

In your Nginx configuration:

    location / {
            # First attempt to serve request as file, then
            # as directory, then fall back to displaying a 404.
            index index.php;
            try_files $uri $uri/ @rewrite;
            expires max;
            # Uncomment to enable naxsi on this location
            # include /etc/nginx/naxsi.rules

    location /blabla {
     try_files $uri $uri/ /blabla/index.php?$args;
    location ~ /blabla/.+\.(jpg|jpeg|gif|css|png|js|ico|xml)$ {
            webuser /usr/share/nginx/html;

Step 2:

Then wherever your docroot is for your site you add an alias with your subfolder name to the main docroot, allowing the path to be valid for Drupal:

$ pwd

user@localhost:/usr/share/nginx/html$ find . -type l -ls
41059    0 lrwxrwxrwx   1 webuser    webuser           21 Sep 25 01:58 ./blabla -> /usr/share/nginx/html

You will still need your sites.php configuration as you have listed. You will need to restart Nginx.

  • try_files $uri $uri/ /blabla/index.php?$args; was crucial, it works fantastic! I was doing many combinations before, but it is a perfect solution, thanks a lot! Commented Dec 2, 2015 at 5:14
  • Is there any way to make it work without creating symlinks in the filesystem? Commented Mar 7, 2020 at 17:10
  • none that i'm aware of.
    – tenken
    Commented Mar 13, 2020 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.