All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
[nginxsite] | Easily enable/disable your nginx site with tab-completion support
I created this script half a year ago, as I notice there was no equivalent command for a2ensite or a2dissite in nginx (don't know if they do now). Tested and confirmed working in nginx derived from Ubuntu maintained package and official package. More info at https://github.com/L1so/nginxsite
Demo

Installation
Script is hosted in github, thus easiest way to download would be using git.
git clone https://github.com/L1so/nginxsite.git
cd nginxsite
sudo ./install
By installing, following things will happen.
- Creating directory
/etc/nginx/sites-{available,enabled}if not exist - Modify nginx config to include
/etc/nginx/sites-availableif not already - Copying main script to
/usr/local/bin/
Enabling site
To activate a site, replace your_site.com with your actual site domain.
sudo ngxensite your_site.com
Disabling site
To deactivate a site, replace your_site.com with your actual site domain.
sudo ngxdissite your_site.com
Creating site
You can now create nginx server block effortlessly.
sudo ngxcreate your_site_name
Running ngxcreate without any argument will give you a prompt to enter desired site name, if you don't include valid 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
Deleting site
To delete a site, replace your_site.com with your actual site domain, example given below.
root@mutiny:~# ngxdelete bar.co
Removing --> /etc/nginx/sites-available/bar.co


Comments
Great job, good to see there's productive members doing their thing
Good job! I like that it's in pure bash script!
Yes it is written in bash, forgot to mention that in the post
, but you can see this on github link.
Thanks for your support, really appreciate it
I have finished creating function to print currently available/enabled sites.
Demo
Pretty self explanatory, use
-eswitch to list enabled sites—if no argument given, it will always print available sites.Thanks for your attention