Open Gonzalo2683 opened 4 years ago
Here is how I do it using nginx, but it should be same for apache.
Subfolders:
sites/first
sites/second
sites.php
$sites['first.drupal.docker.localhost'] = 'first';
$sites['second.drupal.docker.localhost'] = 'second';
docker-compose.yml
nginx:
...
labels:
- 'traefik.backend=${PROJECT_NAME}_nginx'
- 'traefik.port=80'
- 'traefik.frontend.rule=HostRegexp:{subdomain:[a-z]+}.${PROJECT_BASE_URL}'
Note: HostRegexp used instead of Host. And as you can see I append sites to base url - drupal.docker.localhost. You can tweak subdomains to use number if you want, just update regex.
Just make sure to put table prefix when installing (if using single mariadb). Hope it helps. Cheers.
If you are using Apache, here is how the apache
section at docker-compose.yml
should look like:
apache:
...
labels:
- 'traefik.backend=${PROJECT_NAME}_apache'
- 'traefik.port=80'
- 'traefik.frontend.rule=HostRegexp:{subdomain:[a-z]+}.${PROJECT_BASE_URL}'
Codebase mounted codebase
Describe the bug I have reviewed and read about how to set up a multisite with Drupal and I have not managed to work with those answers. Source:
https://github.com/wodby/docker4drupal/issues/69
I have configured as shown in the documentation and also as recommended in github and I cannot make it work.
I need to have 2 subsites (the default does not count), I have two folders inside the sites folder, each with its configuration.
The only site it takes is the default. How can I create additional database for the other sites? I have added to the hosts file:
127.0.0.1 drupal.docker.localhost desa.loc installer.loc
The sites folder extructure:
The sites.php file:
In the browser:
Output of
docker info
Contents of your
docker-compose.yml
Contents of your
.env
Logs output
docker-compose logs
Some of the errors that appear were because the values of db, paswword and host were not correctly configured in the defautl site, after correcting them, it took me to the installation of drupal (the default site)Thanks.