How to create virtual host for magento 2

In this article let’s discuss about How to create virtual host for magento 2. Let’s go through the following methods without any delay.

Method 1:


    ServerName magento2.local
    ServerAlias www.magento2.local
    DocumentRoot /var/www/html/magento
    
        AllowOverride All
      

If you are facing any issues with the above approach then try the alternative that is given below. It may look similar but have a try!

Method 2 :

sudo vi /etc/apache2/sites-available/magento.conf
sudo a2ensite magento.conf
sudo service apache2 restart

Hope the above solution works.

Realted Posts : Bash find full path