Create a new Apache virtual host configuration file named drupal.conf. In this file, we will specify all the details related to our Drupal virtual host configuration. To begin, execute:
sudo a2enmod rewrite
Next, create a file named drupal.conf using:
touch /etc/apache2/sites-available/drupal.conf
Afterward, link this new configuration file to another folder:
ln -s /etc/apache2/sites-available/drupal.conf /etc/apache2/sites-enabled/drupal.conf
Now, open and edit the drupal.conf file:
nano /etc/apache2/sites-available/drupal.conf
Inside the drupal.conf file, input the configuration values for our new virtual host:
ServerAdmin admin@yourdomain.com
DocumentRoot /var/www/html/
ServerName your-domain.com
ServerAlias www.your-domain.com
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
ErrorLog /var/log/apache2/your-domain.com-error_log
CustomLog /var/log/apache2/your-domain.com-access_log common
Following this, restart Apache to apply the changes:
systemctl restart apache2.service