We will enable Virtual Host in your /etc/apache2/apache2.conf file. Open /etc/apache2/apache2.conf file
Finally, restart your Apache2 server
Disable the Apache2 default host configuration
and add this line to the end of the file
NameVirtualHost 127.0.0.1:80
NameVirtualHost 127.0.0.1:443
The virtual host configuration should look like this.
Enable your virtual host configuration
Lets create a virtual host configuration for each site. You don't have to create from scatch actually, you can copy the default host configuration and customize it.
The /etc/apache2/sites-available directory is not parsed by Apache2. Symbolic links in /etc/apache2/sites-enabled point to "available" sites. Use the a2ensite (Apache2 Enable Site) utility to create those symbolic links, like so: sudo a2ensite mynewsite where your site's configuration file is /etc/apache2/sites-available/mynewsite. Similarly, the a2dissite utility should be used to disable sites
The /etc/apache2/sites-available directory is not parsed by Apache2. Symbolic links in /etc/apache2/sites-enabled point to "available" sites. Use the a2ensite (Apache2 Enable Site) utility to create those symbolic links, like so: sudo a2ensite mynewsite where your site's configuration file is /etc/apache2/sites-available/mynewsite. Similarly, the a2dissite utility should be used to disable sites