This how-to have been tested on Ubuntu distro, but should be implemented in any Debian base distribution.

We need view more step to create name base virtual host. First change user as root. To do that type the following command:

sudo su

enter your root password

Copy default file from directory /etc/apache2/sites-available/ using a new name that you prefer as virtual host name. Type:

cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mynewsite

note: you can replace ‘mynewsite’ with your own.

Make sure you have created a new folder for your root website directory. By default, Ubuntu placed root website at /var/www
Next, we have to edit the file that we have just created. To do that type this command:

vim /etc/apache2/sites-available/mynewsite

Then view parameter:

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName www.mynewsite.com #change with your virtualhost name
DocumentRoot /var/www/mynewsite/ #point to your root website directory
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/mynewsite/> #point to your root website directory
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

Then save it.

To activated your new virtualhost type the following command:

sudo a2ensite mynewsite

Note: “mynewsite” is a configuration file name for your new virtualhost. You can change it with yours.
Last step is reload your apache by typing this command:

sudo /etc/init.d/apache2 reload

To test your new virtualhost you have to edit /etc/hosts file and add your local IP and your virtualhost name. To do that type this command:

vim /etc/hosts

Then add this following line:

127.0.0.1 www.mynewsite.com

Save and exit. Now open your borwser and type http://www.mynewsite.com. If everything correct, you will see your new site.