Whenever I want to setup a new vhost on my server(Linux Ubuntu), I always do it manually. It’s not that bad but it really gets on my nerve if I have to do it more than 2-3 site everyday or month.

After do a little research how to automate this process, it’s actually quite easy. Here’s how:

You will need to create a shell script on your server. I actually create a repo on github, you can clone it from here .

Login & go to your home directory

git clone [email protected]:ekka21/ubuntu-add-vhost.git shell

Once you have it on  server, this script needs to be executable.

cd shell; chmod +x vhost.sh;

How to use it?…

sudo ./vhost.sh

After that you just need to follow the command prompt

This script cuts down about 10-20mins of your time, so you can concentrate on what you do best…CODING!