Skip to content
Bash Script to easy create or delete apache virtual hosts on ubuntu
Branch: master
Clone or download
Pull request Compare This branch is 4 commits behind RoverWire:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Virtualhost Manage Script

Bash Script to allow create or delete apache/nginx virtual hosts on Ubuntu on a quick way.


  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/
You can’t perform that action at this time.