Create Drupal 10 fresh instance with composer command
Below composer command will download latest Drupal version.
composer create-project drupal/recommended-project d10multisite
OR
Below composer command will download Drupal specific version.
composer create-project drupal/recommended-project:10.3.2 d10multisite
Create virtual hosts in xampp
c:\xampp\apache\conf\extra\httpd-vhosts.conf
<VirtualHost *:80>
ServerName d10multisite.localhost
ServerAlias www.d10multisite.localhost
DocumentRoot "C:/xampp/htdocs/d10multisite/web"
<Directory "C:/xampp/htdocs/d10multisite/web">
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName d10multisite-site1.localhost
ServerAlias www.d10multisite-site1.localhost
DocumentRoot "C:/xampp/htdocs/d10multisite/web"
<Directory "C:/xampp/htdocs/d10multisite/web">
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName d10multisite-site2.localhost
ServerAlias www.d10multisite-site2.localhost
DocumentRoot "C:/xampp/htdocs/d10multisite/web"
<Directory "C:/xampp/htdocs/d10multisite/web">
Require all granted
</Directory>
</VirtualHost>
Add below lines in hosts file
C:\Windows\System32\drivers\etc\hosts
127.0.0.1 d10multisite.localhost
127.0.0.1 d10multisite-site1.localhost
127.0.0.1 d10multisite-site2.localhost
cd sites/
ls
cp example.sites.php sites.php
sites.php :- is a file where we are going to configure how many sites are there and mapped to which domain and mapped to which folder.
edit sites.php
go to the bottom of the file
$sites["d10multisite.localhost"] = 'default';
$sites["d10multisite-site1.localhost"] = 'site1';
$sites["d10multisite-site2.localhost"] = 'site2';
every site is having different settings.php
cd default
cp example.settings.php settings.php
cd site1
cp default/default.settings.php site1/settings.php
cd site2
cp default/default.settings.php site2/settings.php
every site is having different services.yml
// default
cp default/default.services.yml default/services.yml
// site1
cp default/default.services.yml site1/services.yml
// site2
cp default/default.services.yml site2/services.yml
Restart xampp server
check in browser with below urls
d10multisite.localhost
d10multisite-site1.localhost
d10multisite-site2.localhost
Now install Drupal instances with standard profile installation.
Now I have to install module with composer, then run below command
composer require drupal/devel
It will download module from Drupal.org
Now I have to enable this module on any specific site, run below drush command
drush en devel --uri="d10multisite.localhost"