All of us living in the debian based world (ubuntu) have grown accustomed to a2ensite/a2dissite/etc scripts that come with apache to help manage your vhosts. Nginx was sadly left out of these cool commands so I’ve decided to add them here.

You can run this script and it will add these beloved commands as “n2ensite” and “n2dissite”

wget -O /usr/bin/n2ensite
chmod 755 /usr/bin/n2ensite
ln -s /usr/bin/n2ensite /usr/bin/n2dissite

Then on debian/ubuntu based systems install the bash autocomplete:

wget \
-O /etc/bash_completion.d/nginx
. /etc/bash_completion

Test your new commands:

n2ensite <tab>

Goodluck! Feel free to leave a comment below with feedback and corrections. Also if you found this helpful and would like occasional updates of things happening in this arena subscribe to the newsletter. Thanks!