Drupal Multisite Setup on a XAMPP with Localhost

Multisite Setup on a XAMPP with Local Host

Download a XAMPP on your local computer.   Recommendations followed not to download into system files as there are some firewall problems. (E.g., c:\xampp) Upload the instance Drupal 8 that will serve as the root site for our multi-site case.

For our multisite case, install a Drupal 8 instance that will serve as the root location. The root site will be named drupal8multisite in our case, will be accessible at drupal8multisite.com, and will be installed at /xampp / htdocs / drupal8multisite

Set up a multisite site called site1 .. 5 that can be reached on drupal8multisite.com.site1 ...... 4 

Step 1: Installing XAMPP
Upload the file to your local drive and install it easily using the defaults Locate your hosts files-these can be located in a variety of locations (C:\Windows\System32\drivers\hosts).

For example:
127.0.0.1    localhost
127.0.0.1    drupal8multisite.com
127.0.0.1    drupal8multisite.com.site1
127.0.0.1    drupal8multisite.com.site2
127.0.0.1    drupal8multisite.com.site3
127.0.0.1    drupal8multisite.com.site4

Note: They all point to the same local host address. Make your virtual hosts in httpd-vhosts.conf -(e.g., located here: C:\xampp\apache\conf\extra\httpd-vhosts.conf)

#
<VirtualHost *:80>
    ServerName drupal8multisite.com 
    DocumentRoot "C:/xampp/htdocs/drupal8/web"
    <Directory  "C:/xampp/htdocs/drupal8/web/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

#
<VirtualHost *:80>
    ServerName drupal8multisite.com.site1
    DocumentRoot "C:/xampp/htdocs/drupal8/web"
    <Directory  "C:/xampp/htdocs/drupal8/web/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

#
<VirtualHost *:80>
    ServerName drupal8multisite.com.site2
    DocumentRoot "C:/xampp/htdocs/drupal8/web"
    <Directory  "C:/xampp/htdocs/drupal8/web/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
    </Directory>
</VirtualHost>

#
<VirtualHost *:80>
    ServerName drupal8multisite.com.site3
    DocumentRoot "C:/xampp/htdocs/drupal8/web"
    <Directory  "C:/xampp/htdocs/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 SiteDownload and import a copy of Drupal 8 into that site directory to create a database for the multisite root site.
Install Drupal by visiting and following the install UI at drupal8multisite.com.

Step 3: Setup your sites folder
Navigate to the folder of your sites (e.g., C:/xampp / htdocs / drupal8/web / sites).
Copy example.sites.php and rename it to sites.php If your naming convention does not require an alias-that is all you need.   No sym-links-no extra things.

Build subfolders for each of your sites-name them with the base URL you set in step 1.2 (e.g., drupal8multisite.com.site1);

Each sub-site should have these folders

  • files
  • modules
  • themes

Copy settings.php file into folder and change database link and path of private files
 Save services.yml file into the Finished folder-you can go to the pages!

Tags

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
18 + 2 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.