Home > General, HowTo, Linux, Tips > Manage your virtual hosts on apache server easily

Manage your virtual hosts on apache server easily

Building up and making all modifications on your server is pretty boring. There is no need to find the sun again and again. I’ve had to go through the process of reconfiguring my virtual hosts for Apache2 several times and i found a pre modified shell script and modified the script according to my needs. This script enables you to create, destroy your virtual host in a second.

you can download the script from here : vhost.txt or;

mkdir ~/bin
cd ~/bin
wget http://samet.kilictas.com/wp-content/uploads/2011/05/vhost.txt
mv vhost.txt vhost
chmod 755 vhost

Now, to invoke the script, type the following:

. ~/bin/vhost

By using this script you can create, destroy a virtual host. In order to create a new host on your server user following command by replacing appreciate values:

vhost create <domain> <admin-email> <host-ip>

The script creates required directories,files as shown below;

Web directories

Web cgi-bin

Web logs

then builds virtual host config file and enables it right away (enabling is optional), which is placed in following directory


After getting done with all these process it simply creates a little info file


Great you have created and enabled your virtual host, you may need to destroy a virtual host, here is how;

vhost destroy <domain>

get some help with;

vhost help
VN:F [1.9.22_1171]
Rating: 5.5/10 (4 votes cast)
VN:F [1.9.22_1171]
Rating: +3 (from 3 votes)
Manage your virtual hosts on apache server easily, 5.5 out of 10 based on 4 ratings
Categories: General, HowTo, Linux, Tips Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.