Composer can be used to manage Drupal and all dependencies (modules, themes, libraries). Make sure you have composer installed on your local machine before executing any Composer commands
- Create/Download Project using composer
- Install Drush
- Install Drupal site using drush and configured Database
- configured local site: apache vhost file
- configured local site : windows host file
- Open browser and hit local configured websites
- Login and check drupal and PHP version
Related: Download & install drupal 9 using composer with lando
To Create/Download Drupal Project
command: sudo composer create-project drupal/recommended-project headlessproject


Install Drush
Command: sudo composer require drush/drush

Install Drupal site using drush and configured Database
command: drush site:install


Configured local site: apache vhost file
command: sudo vi /etc/apache2/sites-available/vhosts.conf
<VirtualHost *:80>
ServerName drupalheadless.test
ServerAlias www.drupalheadless.test
DocumentRoot "/var/www/drupalvm/drupalprojects/headlessproject/web"
<Directory "/var/www/drupalvm/drupalprojects/headlessproject/web">
AllowOverride All
Options -Indexes +FollowSymLinks
Require all granted
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:fcgi://127.0.0.1:9000"
</FilesMatch>
</VirtualHost>
Copy the above code and past in this terminal and save using: Esc + :wq

Configured website in vhost file at your local computer
- search notepad in your windows
- right click on notepad and open as administrator

Click on file and Open path: C:\Windows\System32\drivers\etc




Re-start server
command: sudo service apache2 restart

Clear cache
command: drush cr

Open any browser and hit in URL: drupalheadless.test

click on login and enter your user name: admin and password: 2iKW6NeUEQ (which is generated by drupal when we have installed using drush)


