Bash scripts to quickly add and remove domains in an apache2 environment on Debian.
Creates website directory in /var/www
writes config, enables site, and optionally adds index.html
file.
You can edit the port the website will use by editing the PORT=YOUR_PORT
variable in the newdomain.sh
script.
- Put files onto target machine. e.g:
wget https://raw.githubusercontent.com/YeloPartyHat/Apache2Domains/main/newdomain.sh && wget https://raw.githubusercontent.com/YeloPartyHat/Apache2Domains/main/removedomain.sh
- Navigate to the location you put the files using
cd
- Run files using
sudo bash file.sh
e.g:sudo bash newdomain.sh
- Follow in-console prompts
These scripts rely on apache2 to work and must be executed using the super user (sudo).
sudo apt install apache2
- You may notice you can't immediately run the file when you place it. This is because you don't have the adequate permissions. To fix this, use:
chmod +x file.sh
Use with caution!
I am not responsible if you accidentally register the wrong domain or remove something important!