72 lines
2.8 KiB
Markdown
72 lines
2.8 KiB
Markdown
# MakeVHost
|
|
|
|
This tool automates the process of creating a Virtual Host on a Debian server running Apache2.
|
|
|
|
Currently it only supports Apache2, and only works on a standard Debian server. In the future I plan to expand on this, so if you want your OS and setup supported, drop me a chat request on Reddit /u/thisiszeev.
|
|
|
|
## Installation
|
|
|
|
Once the .sh file is downloaded, chmod it:
|
|
|
|
```
|
|
# chmod +x makevhost.sh
|
|
```
|
|
|
|
Then move it to /usr/bin/ and remove the .sh to make life easier:
|
|
|
|
```
|
|
# mv makevhost.sh /usr/bin/makevhost
|
|
```
|
|
|
|
Then, if not installed, install Certbot from Let's Encrypt:
|
|
|
|
```
|
|
# apt update && apt -y upgrade && apt -y install certbot python3-certbot-apache
|
|
```
|
|
|
|
## How to use it
|
|
|
|
It's very easy. If you followed the steps above, then from anywhere in your server, type:
|
|
|
|
```
|
|
# makevhost {desired.domain.tld}
|
|
```
|
|
|
|
If you omit the domain at this stage, then it will stop and ask you for the domain.
|
|
|
|
It first creates the web folder under /var/www/desired.domain.tld/ with a very basic index.html to make sure the VHost works. Then it will create the log folder under /var/log/apache2/desired.domain.tld/. It also sets the permissions. The webfolder and files are set to owner:group being www-data:www-data and the log folder is set to owner:group being root:adm.
|
|
|
|
After this is done, it will create a conf file for your desired VHost under /etc/apache2/sites-available/desired.domain.tld.conf. Please note, a very very very basic conf file is created. I will expand on this at a later stage.
|
|
|
|
This is followed by enabling the VHost and then testing the domain is active. If it is not active, then it will wait, and test every 300 seconds. You can go to your DNS server and set up the A Record or C Name. Once the domain is active, it will then proceed to create the SSL certificates with Let's Encrypt.
|
|
|
|
## Roadmap
|
|
|
|
- Add support for other distros by detecting where the www folder is and where the logs are stored.
|
|
- Add support for Nginx.
|
|
- Add support to remove a VHost.
|
|
- Add support for Reverse Proxy.
|
|
- Any other ideas, start a chat with me on Reddit /u/thisiszeev
|
|
|
|
## DISCLAIMER
|
|
|
|
This is not a production tool, this is merely a tool to automate the steps of setting up a VHost in a selfhosted/homelab environment.
|
|
|
|
# Donations
|
|
|
|
Please consider making me small donation. Even though my scripts are open source and free to use, I still need to eat. And the occasional bottle of wine also goes down well.
|
|
|
|
- $5 buys me a cup of coffee
|
|
- $10 buys me a nice burger
|
|
- $20 buys me a bottle of wine
|
|
- Anything above that will be awesome as well.
|
|
|
|
You can send me a donation via Paypal https://www.paypal.com/paypalme/thisiszeev
|
|
|
|
Drop me a message on Reddit if you do make a donation. u/thisiszeev
|
|
|
|
Support is only offered freely to those who donate $20 or more.
|
|
|
|
Your donation contributes to further development.
|
|
|
|
If you need a custom script, contact me on Reddit for pricing. |