Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

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

LisoLiso Member

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

a

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.

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

  • risharderisharde Host Rep, Veteran

    Great job, good to see there's productive members doing their thing

  • ericlsericls Member, Patron Provider

    Good job! I like that it's in pure bash script!

    Thanked by 2webcraft netomx
  • LisoLiso Member
    edited July 2022

    @ericls said:
    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.

    @risharde said:
    Great job, good to see there's productive members doing their thing

    Thanks for your support, really appreciate it :)

  • LisoLiso Member

    I have finished creating function to print currently available/enabled sites.

    Demo

    Alt

    Pretty self explanatory, use -e switch to list enabled sites—if no argument given, it will always print available sites.

    Thanks for your attention :smiley:

    Thanked by 1webcraft
Sign In or Register to comment.