Drupal 8 Multisite on a WAMP stack - Local Host
The multisite behavior is a great way to explore the functionality and prototyping of sites and building out a content management ecosystem. With drupal 8 and the many installation instructions out there - wanted to prepare a basic guide on how to get this to work for those looking to simply do it locally on their windows machines. We'll leverage the LAMP Multisite instructions for the sake of alignment.
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)
#
<VirtualHost *:80>
ServerName d8multisite.com
DocumentRoot "C:/wamp64/www/drupal8/web"
<Directory "C:/wamp64/www/drupal8/web/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>#
<VirtualHost *:80>
ServerName d8multisite.com.site1
DocumentRoot "C:/wamp64/www/drupal8/web"
<Directory "C:/wamp64/www/drupal8/web/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>#
<VirtualHost *:80>
ServerName d8multisite.com.site2
DocumentRoot "C:/wamp64/www/drupal8/web"
<Directory "C:/wamp64/www/drupal8/web/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>#
<VirtualHost *:80>
ServerName d8multisite.com.site3
DocumentRoot "C:/wamp64/www/drupal8/web"
<Directory "C:/wamp64/www/drupal8/web/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
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
- Each sub-site should have these folders
Done - you can go to the sites!
Help improve this page
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion