If you are running more than one Drupal site, you can simplify the management and can upgrade your sites by using the multi-site feature. Multi-site allows you to share a single Drupal installation (including core code, contributed modules, and themes) among several sites.
This is particularly useful for managing the code since each upgrade only needs to be done once. Each site will have its own database and its own configuration settings, so each site will have its own content, settings, enabled modules, and enabled theme. However, the sites are sharing a code base and web document root, so there may be security concerns with multiple administrators.
- Add new comment
- 254 views
Comment
Drupal 8 multisite setup
Submitted by TS (not verified) on Thu, 10/25/2018 - 06:12
Overview of the process:
Install a WAMP on your local machine. Followed recommendations to not install in program files as there is some firewall problems. (e.g., c:\wamp64)
Install a Drupal 8 instance that will act as the root site for our multisite instance. In our example, the root site will be called d8multisite, will be reachable at d8multisite.com, and will be installed at /var/www/d8multisite
Set up a sites within the multisite called site1..5 which is reachable at d8multisite.com.site1..5
Step 1: Installing WAMP Stack
Download the file to your local drive and simply install using the defaults
Locate your hosts files - these can be tucked in a variety of locations (C:\Windows\System32\drivers\hosts). This will be important to keep a backup and you'll have to add the name of your server to this file.
For example:
127.0.0.1 localhost
127.0.0.1 d8multisite.com
127.0.0.1 d8multisite.com.site1
127.0.0.1 d8multisite.com.site2
127.0.0.1 d8multisite.com.site3
127.0.0.1 d8multisite.com.site4
127.0.0.1 d8multisite.com.site5
Note: They all point to the same local host address
Create your virtual hosts in the httpd-vhosts.conf -(e.g., located here: C:\wamp64\bin\apache\apache2.4.33\conf\extra\httpd-vhosts.conf)
#
ServerName d8multisite.com
DocumentRoot "C:/wamp64/www/drupal8/web"
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
#
ServerName d8multisite.com.site1
DocumentRoot "C:/wamp64/www/drupal8/web"
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
#
ServerName d8multisite.com.site2
DocumentRoot "C:/wamp64/www/drupal8/web"
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
#
ServerName d8multisite.com.site3
DocumentRoot "C:/wamp64/www/drupal8/web"
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
Note: You would simply keep repeating the VM's for each site you have - pattern is the same.
Step 2: Installing Drupal - Main Site
Create a database for the multisite root site
Download and extract a copy of Drupal 8 into that web directory.
Install Drupal by visiting d8multisite.com and following the install UI.
Step 3: Setup your sites folder
Navigate to your sites folder (e.g., C:/wamp64/www/drupal8/web/sites)
Copy example.sites.php and rename to sites.php If your naming convention does not require alias - that's all you need to do. No sym links - none of the extra aspects.
Create the subfolders for each of your sites - name them with the base URL you defined in step 1.2 (e.g., d8multisite.com.site1)
Each sub-site should have these folders
files
modules
themes
Copy settings.php file into the folder and update database connection and private files path
Copy services.yml file into the folder
Done - you can go to the sites!
https://www.drupal.org/docs/8/multisite/drupal-8-multisite-on-a-wamp-st…