Simple bash script to perform CRUD (Create, Read, Update, and Delete) virtual host using Nginx
- Download the codes via terminal on your server
$ wget https://github.com/wildan3105/Nginx-Vhost-CRUD-Operation/archive/master.zip
- Unzip the codes
$ unzip master.zip /path/to
- Change permission for all files
$ chmod +x *.sh
-
Start managing your Nginx virtual host and be productive !
-
Optional : If you wanna edit the script on your own, you can also change permission to 755 to enable editing
$ chmod 755 *.sh
Assumption(s) : You have set your basic Nginx virtual host / server blocks. If you haven't set it yet, check to this link :
How to set up nginx virtual host on Ubuntu 16.04
Basic command line syntax :
$ sudo ./create.sh [argument]
-
Create a new virtual host :
Syntax :
$ sudo ./create.sh [domain]
Example :
$ sudo ./create.sh blog.wildan.us
-
List all active virtual host(s):
Syntax :
$ ./read.sh
Example :
$ ./read.sh
-
Delete certain virtual host :
Syntax :
$ sudo ./delete.sh [domain]
Example :
$ sudo ./delete.sh blog.wildan.us
-
Update virtual host address :
Syntax :
$ sudo ./update.sh [old-domain] [new-domain]
Example :
$ sudo ./update.sh blog.wildan.us notes.wildan.us
- Add usage.sh
- Check if domain already exist
- Colored output text
MIT