To create a virtual host or local site in ubuntu machine, do the following things- 1) Put your contents in your local machine, for me its in "/var/www/html/workingdir/testdomainfolder" 2) Cd /etc/apache2/sites-available/ 3) Create a file name- "www.testdomain.com", do the following- sudo vim www.testdomain.com 4) Write the following contents in "www.testdomain.com", change domain name according to your and write your document root <VirtualHost *:80> ServerName www.testdomain.com DocumentRoot /var/www/html/workingdir/testdomainfolder ScriptAlias /cgi-bin/ /usr/lib/cgi-bin <Directory /var/www/html/workingdir/testdomainfolder> Order allow,deny Allow from all Options +FollowSymLinks -Indexes AllowOverride All </Directory> <Directory /usr/lib/cgi-bin> Order allow,deny Allow from all Options None AllowOverride None </Directory> CustomLog /var/www/logs