Skip to content

Latest commit

 

History

History
73 lines (41 loc) · 2.02 KB

README.md

File metadata and controls

73 lines (41 loc) · 2.02 KB

Nginx Virtual Host CRUD Operation

Codacy Badge

Simple bash script to perform CRUD (Create, Read, Update, and Delete) virtual host using Nginx

Installation

  1. Download the codes via terminal on your server

$ wget https://github.com/wildan3105/Nginx-Vhost-CRUD-Operation/archive/master.zip

  1. Unzip the codes

$ unzip master.zip /path/to

  1. Change permission for all files

$ chmod +x *.sh

  1. Start managing your Nginx virtual host and be productive !

  2. Optional : If you wanna edit the script on your own, you can also change permission to 755 to enable editing

$ chmod 755 *.sh

Usage

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]

Examples

  1. Create a new virtual host :

    Syntax : $ sudo ./create.sh [domain]

    Example : $ sudo ./create.sh blog.wildan.us

  2. List all active virtual host(s):

    Syntax : $ ./read.sh

    Example : $ ./read.sh

  3. Delete certain virtual host :

    Syntax : $ sudo ./delete.sh [domain]

    Example : $ sudo ./delete.sh blog.wildan.us

  4. Update virtual host address :

    Syntax : $ sudo ./update.sh [old-domain] [new-domain]

    Example : $ sudo ./update.sh blog.wildan.us notes.wildan.us

Further Development

  • Add usage.sh
  • Check if domain already exist
  • Colored output text

Contributor

License

MIT