nginx icon indicating copy to clipboard operation
nginx copied to clipboard

Drupal multisite as subfolder

Open heyyo-droid opened this issue 6 months ago • 3 comments

I'm struggling to create multisites as subfolders in a Drupal 10.

For example my Drupal website has this url: http://d10.docker.localhost

And my multisites should be of this form:

  • http://d10.docker.localhost/site1
  • http://d10.docker.localhost/site2

So inside my sites.php I have:

<?php

$sites["d10.docker.localhost.site1"] = "site1";
$sites["d10.docker.localhost.site2"] = "site2";

And each multisites have their own folder under /var/www/html/web/sites with settings.php with their own database (for now empty)

  • /var/www/html/web/sites/site1
  • /var/www/html/web/sites/site2

According Drupal 7 documentation (Doc for Drupal 8/9/10/11 was not updated), we also need to create symlinks for each multisite in web/ folder pointing to web.

So from /var/www/htm/web I did

ln -s . site1
ln -s . site2
chown -h 1000:82 site1 # to get correct owner/group
chown -h 1000:82 site2

If I test drush status inside multisite folder, I can see correct multisite detected.

So for Drupal, multisite seems correctly declared.

But when I browse urls:

  1. http://d10.docker.localhost/site1 returns a 404 from Drupal.
  2. http://d10.docker.localhost/site1/core/install.php returns a 404 from nginx.
  3. http://d10.docker.localhost/site1/core/misc/druplicon.png I got a 200 response

So according 3., it seems nginx follows correctly the symlinks, but according 2. and 3. it seems there is something wrong with priority and symlinks.

heyyo-droid avatar Aug 23 '24 09:08 heyyo-droid