This tutorial will teach beginners to setup local dev site on Ubuntu.
First step in this process is to edit Apache’s primary configuration file at /etc/apache2/apache2.conf
I used the below command to open apache2.conf
cd /etc/apache2/ subl /etc/apache2/apache2.conf
or you can use
sudo nano apache2.conf
Then I added the below line at the bottom of the file.
IncludeOptional /home/sibi/conf/vhosts.conf
Created conf and www folder in home
and then created vhosts.conf file with following content in /home/sibi/conf/
<VirtualHost 127.0.0.1:80> ServerName demo.test DocumentRoot /home/sibi/www/demo <Directory "/home/sibi/www/demo"> Options All AllowOverride All Require all granted Order allow,deny allow from all </Directory> </VirtualHost>
Opened the hosts file
subl /etc/hosts
and added the below line
127.0.0.1 demo.test
Created demo folder inside ‘www’ (/home/sibi/www/), then created index.html file for demo folder.
Restarted apache
sudo service apache2 restart