An improved nginx_ensite script
GitHub - cdzombak/nginx_ensite: Quickly enable/disable nginx sites
Quickly enable/disable nginx sites. Contribute to cdzombak/nginx_ensite development by creating an account on GitHub.
I have long used a script called nginx_ensite
to quickly test and enable Nginx site configurations. (It also comes with a sister script, nginx_dissite
, which disables a site.)
For a long, long time, I have wanted to add a few features, and I finally have:
- Installable via my Debian apt repository
- Is aware of
systemctl reload
- Accepts a flag to automatically reload Nginx's configuration after the configuration change is made
Usage now looks like this:
cdzombak@azul:$ sudo nginx_dissite -r 10foot6.in
Site 10foot6.in has been disabled.
Reloading nginx...
Nginx reloaded successfully.
cdzombak@azul:$ sudo nginx_ensite -r 10foot6.in
Pre-flight check...
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
New config check...
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Site 10foot6.in has been enabled.
Reloading nginx...
Nginx reloaded successfully.
My fork of this tool maintains existing features, like a proper manual page and Bash completions.
If you work with Nginx, try it out today! The project's README provides installation instructions.