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:
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:
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:
Then view parameter:
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:
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:
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:
Then add this following line:
Save and exit. Now open your borwser and type http://www.mynewsite.com. If everything correct, you will see your new site.


