Skip to content

L1so/nginxsite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nginxsite - a2ensite replacement written in Bash

Easy enabling/disabling site on NginX, using Bash Script. This is an attempt to replicate apache a2ensite & a2dissite feature.

Tested in official upstream package of nginx and Ubuntu derivative package.

Feature

  • Autocomplete.
  • Interactive menu.
  • Easy [un]install script.
  • Beginner friendly.

Installation

Download your copies of repository, then execute install script located on main directory. Note that this required root user.

wget -O nginxsite.zip https://github.com/L1so/nginxsite/archive/refs/heads/main.zip
unzip -qq nginxsite.zip && rm nginxsite.zip
cd nginxsite-main && sudo ./install

Or if you prefer git clone.

git clone https://github.com/L1so/nginxsite.git
cd nginxsite && sudo ./install

By installing, following things will happen.

Removing

Just execute uninstall script located on this repository.

sudo ./uninstall

It will remove all trace of nginxsite.

Usage

Enabling

To activate a site, replace (YOUR SITE) with your actual site domain (located in /etc/nginx/sites-available/).

sudo ngxensite (YOUR SITE)

Disabling

To deactivate a site, replace (YOUR SITE) with your actual site domain (located in /etc/nginx/sites-available/).

sudo ngxdissite (YOUR SITE)

Create server block

To create a site, replace (YOUR DOMAIN) with your actual domain.

sudo ngxcreate (YOUR DOMAIN)

Running ngxcreate without any argument will give you a prompt to enter desired site name, if you don't include tld, the script will give you .com domain.

$ sudo ngxcreate
Please Enter a Domain Name (default TLD is .com):
examplesite

Will save a new file named /etc/nginx/sites-available/examplesite.com

Delete server block

To delete a site, replace (YOUR DOMAIN) with your actual site domain.

sudo ngxdelete (YOUR DOMAIN)

Example given below.

root@mutiny:~# ngxdelete bar.co 
Removing --> /etc/nginx/sites-available/bar.co

List site

To list site, simply type ngxlist (or ngxlist -e to show enabled sites).

s

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages