Saturday, September 22, 2012

Adding VHost to apache2 (Ubuntu 12.04)

Following steps is not include installation of apache2.

1. Create vhost dir.
sudo mkdir /etc/var/www/

2. I use for development, so I map the localhost IP to, if you using internet IP, go to next step.

sudo nano /etc/hosts

#add line

3. Grant permissions to 'www/'

sudo chown www-data:www-data /var/www/ -R

sudo chmod 755 -R /var/www/

4. Creating Vhost file.

cd /etc/apache2/sites-available
cat default >

#add line after ' ServerAdmin webmaster@localhost'
DocumentRoot   /var/www/

#correct the <Directory> tag with correct attribute.
 <Directory /var/www/>

5. Enable the site.

services apache reload

6. Test the site by browser the