Tag Archives: virtual host

How to create virtual host on ubuntu apache2

create conf file under /etc/apache2/sites-available/
name it as vhosts.conf and put following contents

<VirtualHost 127.0.0.3:80>
	ServerAdmin webmaster@test.dev
	ServerName test.dev
	ServerAlias www.test.dev
	DocumentRoot /var/www/html/projects/test
	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost> 

run following command to enable site

sudo a2ensite vhosts.conf

run following command to restart apache service

sudo service apache2 restart

run following command to enable rewrite mode

sudo a2enmod rewrite 

and thats it, now you can access test.dev in your browser.