Skip to content
BASH script for creating local domains on Debian and Debian-based distributions.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Local Domains

Local Domains is a simple BASH script for creating local domains on Debian and Debian-based distributions.

Help Example

Script has been tested on the following distributions:

  • Ubuntu 17.10 - 18.04
  • Debian 9.3 - 9.5

Buy Me Coffee

Versioning Scheme

I use a 3-digit Semantic Versioning identifier, for example 1.0.2. These digits have the following meaning:

  • The first digit (1) specifies the MAJOR version number.
  • The second digit (0) specifies the MINOR version number.
  • The third digit (2) specifies the PATCH version number.

Complete documentation can be found by following the link above.


This script was made for Debian and Debian-based distributions with LAMP stack installed.

Example 1 - Adding

In this example, we are adding a local domain with the root directory /var/www/html/my-cool-server.

bash ./ -d -rd /var/www/html/my-cool-server -v -a

Directory /var/www/html/my-cool-server will be created if it doesn't already exist.

You can now access from your network.

Example 2 - Removing

In this example, we are removing a local domain

bash ./ -d -rd /var/www/html/my-cool-server -v -r

Apache configuration files and domain will be removed, but the directory /var/www/html/my-cool-server will remain unaffected.

Example 3 - Interactive Mode

Interactive mode has been added to simplify usage of the script. It's an easy way to manage your domains.

bash ./ -i

Parameter for the interactive mode can be combined with other parameters to skip unwanted steps.

Example 4 - Purging Root Directory

Root directory of a domain can easily be purged, but tread lightly, as all files and folders will be permanently removed from it.

When Adding

bash ./ -d -rd /var/www/html/my-cool-server -v -a -p

When Removing

bash ./ -d -v -r -p


  • Enabling SSL is easy, just pass the -s or --ssl parameter when adding a domain
  • Removing a domain will not remove the files from the specified root directory unless you pass the -p parameter

If you plan to use this script everyday, you should probably create an alias.

Temporary Alias

alias local-domains="/path/to/your/folder/"

Permanent Alias

echo alias local-domains="/path/to/your/folder/" >> ~/.bash_aliases


Alternatively, you can add my personal APT repository to your machine and install LocalDomains like you would anything else.

Add the repository.

wget -nc
sudo apt-key add release.key
sudo echo "deb general main" >> "/etc/apt/sources.list"
sudo apt-get update

Install project.

sudo apt-get install local-domains


Please review the following documents if you are planning to contribute to the project:


Please don't hessitate to contact me if you have any questions, ideas, or concerns.

My Twitter account is: @jocic_91

My support E-Mail address is:

Copyright & License

Copyright (C) 2018 Đorđe Jocić

Licensed under the MIT license.

You can’t perform that action at this time.