Local Domains is a simple BASH script for creating local domains on Debian and Debian-based distributions.
Script has been tested on the following distributions:
- Kali Linux 2020.2
- Ubuntu 17.10 - 18.04
- Debian 9.3 - 9.5
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.
In this example, we are adding a local domain www.my-cool-server.test with the root directory /var/www/html/my-cool-server.
bash ./local-domains.sh -d www.my-cool-server.test -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 www.my-cool-server.test from your network.
In this example, we are removing a local domain www.my-cool-server.test.
bash ./local-domains.sh -d www.my-cool-server.test -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.
Interactive mode has been added to simplify usage of the script. It's an easy way to manage your domains.
bash ./local-domains.sh -i
Parameter for the interactive mode can be combined with other parameters to skip unwanted steps.
Root directory of a domain can easily be purged, but tread lightly, as all files and folders will be permanently removed from it.
bash ./local-domains.sh -d www.my-cool-server.test -rd /var/www/html/my-cool-server -v -a -p
bash ./local-domains.sh -d www.my-cool-server.test -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.
alias local-domains="/path/to/your/folder/local-domains.sh"
echo alias local-domains="/path/to/your/folder/local-domains.sh" >> ~/.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 https://www.djordjejocic.com/storage/app/media/other/release.key
sudo apt-key add release.key
sudo echo "deb http://apt.djordjejocic.com 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: [email protected]
Copyright (C) 2018 Đorđe Jocić
Licensed under the MIT license.