create ssl virtual host apache2 code example
Example 1: create virtual host for magento 2
sudo vi /etc/apache2/sites-available/magento.conf
sudo a2ensite magento.conf
sudo service apache2 restart
Example 2: create virtual host for magento 2
<VirtualHost *:80>
ServerName magento2.local
ServerAlias www.magento2.local
DocumentRoot /var/www/html/magento
<Directory /var/www/html/magento/>
AllowOverride All
</Directory>
</VirtualHost>