Apache Hosting Linux

Automated Script To Create Virtual Host on Linux

It is always complicated to create virtual hosts every time you setup a new website especially for developers and webs designers who do it regularly. This script will automate this process of creating virtual hosts with a single command:

sudo virtualhost create

Download From Github

Credits: Thanks to for this useful script


  1. Download the script
  2. Apply permission to execute:
$ chmod +x /path/to/
  1. Optional: if you want to use the script globally, then you need to copy the file to your /usr/local/bin directory, is better if you copy it without the .sh extension:
$ sudo cp /path/to/ /usr/local/bin/virtualhost

For Global Shortcut

$ cd /usr/local/bin
$ wget -O virtualhost
$ chmod +x virtualhost
$ wget -O virtualhost-nginx
$ chmod +x virtualhost-nginx


Basic command line syntax:

$ sudo sh /path/to/ [create | delete] [domain] [optional host_dir]

With script installed on /usr/local/bin

$ sudo virtualhost [create | delete] [domain] [optional host_dir]


to create a new virtual host:

$ sudo virtualhost create

to create a new virtual host with custom directory name:

$ sudo virtualhost create my_dir

to delete a virtual host

$ sudo virtualhost delete

to delete a virtual host with custom directory name:

$ sudo virtualhost delete my_dir


For Apache:

$ sudo cp /path/to/locale/<language>/ /usr/share/locale/<language>/LC_MESSAGES/


$ sudo cp /path/to/locale/<language>/ /usr/share/locale/<language>/LC_MESSAGES/

Leave a Reply

Your email address will not be published. Required fields are marked *