Create Virtual host in Linux : ubuntu for running any standalone application like angularjs in appache

Suppose you want to make a virtual host on port 8090, you need to create a virtual host. You can do it for appache. The interesting part is you dont need to put your web directory in /var/www. You can point it in anaywhere of you drive. Which might help you to standalone app for an angularjs project. Just follow the steps.

1. Go to site-available directory, it is symlinked to site-enabled. It is located to

cd /etc/apache2/sites-available

2. Create a virtual host, say named “msdrg” and put the following lines over there. You can do it just by nano.


sudo nano msdrg

b. paste the following lines over there, suppose I have my app msdrg in my home directory

<VirtualHost *:80>
        DocumentRoot /home/zea/msdrg
        <Directory /home/zea/msdrg/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all


note that I have named the servername as And I will get by this name in browser

3. save it by ctrl+x and run

sudo a2ensite msdrg

4. Reload you apache

sudo service apaceh2 reload

5. Just one more thing to do which is add the server name in your host which located at etc directory.

sudo nano /etc/hosts

you will find your localhost and other hosts. just add your new servername as host there

thats it, save it by pressing ctrl+x and exit. Go to your browser and type, it will load whatever you have in your msdrg dircetory.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>