https://github.com/null93/vhost
NGINX config structure for provisioning virtual hosts with a CLI tool
https://github.com/null93/vhost
cli nginx virtual-host
Last synced: 3 months ago
JSON representation
NGINX config structure for provisioning virtual hosts with a CLI tool
- Host: GitHub
- URL: https://github.com/null93/vhost
- Owner: null93
- Created: 2022-07-08T05:38:25.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-05-28T13:51:46.000Z (6 months ago)
- Last Synced: 2025-05-28T14:41:11.519Z (6 months ago)
- Topics: cli, nginx, virtual-host
- Language: Go
- Homepage:
- Size: 3.44 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NGINX — vhost
> NGINX config structure for provisioning virtual hosts with a CLI tool
## About
This is a proposal for a new NGINX config structure that allows for provisioning virtual hosts with a CLI tool.
Please keep in mind that this is a proof of concept and the actual config files in the example nginx config directory are not complete.
It is the minimum viable product to demonstrate the CLI tool rather than a complete NGINX config.

## Requirements
All you need is docker installed with the docker compose plugin.
## Try It Out
On your host machine, run the following commands:
```
docker compose up -d
docker compose exec nginx bash
```
Once you are inside the docker container, you can create some virtual hosts:
```
vhost create catch-all default-backend
vhost enable default-backend
vhost create wordpress my-blog domain_names=wordpress-127-0-0-1.nip.io
vhost enable my-blog
vhost create magento-2 my-store magento_version=2.4.6.3 domain_names=magento-127-0-0-1.nip.io
vhost enable my-store
```
Finally you can reload nginx to apply the changes:
```
nginx -s reload
```
That's it! You can now visit the following URLs:
```
http://localhost
http://wordpress-127-0-0-1.nip.io
http://magento-127-0-0-1.nip.io
```
## Install
Darwin
### Intel & ARM
```shell
brew tap null93/tap
brew install vhost
```
Debian
### amd64
```shell
curl -sL -o ./vhost_0.0.4_amd64.deb https://github.com/null93/vhost/releases/download/0.0.4/vhost_0.0.4_amd64.deb
sudo dpkg -i ./vhost_0.0.4_amd64.deb
rm ./vhost_0.0.4_amd64.deb
```
### arm64
```shell
curl -sL -o ./vhost_0.0.4_arm64.deb https://github.com/null93/vhost/releases/download/0.0.4/vhost_0.0.4_arm64.deb
sudo dpkg -i ./vhost_0.0.4_arm64.deb
rm ./vhost_0.0.4_arm64.deb
```
Red Hat
### aarch64
```shell
rpm -i https://github.com/null93/vhost/releases/download/0.0.4/vhost-0.0.4-1.aarch64.rpm
```
### x86_64
```shell
rpm -i https://github.com/null93/vhost/releases/download/0.0.4/vhost-0.0.4-1.x86_64.rpm
```
Alpine
### aarch64
```shell
curl -sL -o ./vhost_0.0.4_aarch64.apk https://github.com/null93/vhost/releases/download/0.0.4/vhost_0.0.4_aarch64.apk
apk add --allow-untrusted ./vhost_0.0.4_aarch64.apk
rm ./vhost_0.0.4_aarch64.apk
```
### x86_64
```shell
curl -sL -o ./vhost_0.0.4_x86_64.apk https://github.com/null93/vhost/releases/download/0.0.4/vhost_0.0.4_x86_64.apk
apk add --allow-untrusted ./vhost_0.0.4_x86_64.apk
rm ./vhost_0.0.4_x86_64.apk
```
Arch
### aarch64
```shell
curl -sL -o ./vhost-0.0.4-1-aarch64.pkg.tar.zst https://github.com/null93/vhost/releases/download/0.0.4/vhost-0.0.4-1-aarch64.pkg.tar.zst
sudo pacman -U ./vhost-0.0.4-1-aarch64.pkg.tar.zst
rm ./vhost-0.0.4-1-aarch64.pkg.tar.zst
```
### x86_64
```shell
curl -sL -o ./vhost-0.0.4-1-x86_64.pkg.tar.zst https://github.com/null93/vhost/releases/download/0.0.4/vhost-0.0.4-1-x86_64.pkg.tar.zst
sudo pacman -U ./vhost-0.0.4-1-x86_64.pkg.tar.zst
rm ./vhost-0.0.4-1-x86_64.pkg.tar.zst
```