https://github.com/diversen/apache2-host-enabler
Some scripts written in PHP for enabling and disabling Apache2 hosts on Ubuntu (or maybe other debian systems)
https://github.com/diversen/apache2-host-enabler
apache2-host-create apache2-host-enabler
Last synced: over 1 year ago
JSON representation
Some scripts written in PHP for enabling and disabling Apache2 hosts on Ubuntu (or maybe other debian systems)
- Host: GitHub
- URL: https://github.com/diversen/apache2-host-enabler
- Owner: diversen
- Created: 2019-11-09T13:11:43.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-27T12:21:39.000Z (about 4 years ago)
- Last Synced: 2025-02-07T22:28:39.471Z (over 1 year ago)
- Topics: apache2-host-create, apache2-host-enabler
- Language: PHP
- Homepage:
- Size: 176 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# apache2-host-enabler
Enable and disable virtual hosts on Linux (Only tested on Ubuntu)
It only works for apache2 version >= 2.4.x
It creates the apache2 configuration file, and add the host to /etc/hosts,
and then enable the configuration.
It also creates `logs/` and `htdocs/` dir.
Only tested on Ubuntu, and it may not work for your setup.
## Download phar
You can also just clone this repo and build it - or copy it from the repo.
wget https://github.com/diversen/apache2-host-enabler/raw/master/a2host.phar
sudo cp a2host.phar /usr/local/bin/a2host.phar
sudo chmod +x /usr/local/bin/a2host.phar
## Or Build phar
You will need to have this great tool installed: https://github.com/clue/phar-composer
git clone https://github.com/diversen/apache2-host-enabler
cd apache2-host-enabler
composer install
cd ..
phar-composer build apache2-host-enabler a2host.phar
`a2host.phar` then created.
## Usage
Enable:
mkdir test.somesite.com
cd test.somesite.com
sudo a2host.phar --enable --htdocs=www test.somesite.com
If the flag htdocs is not set then the default htdocs name is `htdocs`
After the host has been enabled you can visit: http://test.somesite.com
Disable:
cd somesite.com
sudo a2host.phar --disable somesite.com
This does not delete any files. It just disables the host.
## https
Using certbot you can add ssl certificate and enable `https`:
sudo certbot --apache
Install certbot:
See: https://certbot.eff.org/all-instructions
License: MIT