Skip to content

Instantly share code, notes, and snippets.

@noorani786
Forked from sheharyarn/nginx.overrides
Created September 23, 2017 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noorani786/dfeb1b9406e29424f46d280c2cd639a9 to your computer and use it in GitHub Desktop.
Save noorani786/dfeb1b9406e29424f46d280c2cd639a9 to your computer and use it in GitHub Desktop.
Restart / Reload Nginx without Entering Sudo Password
# Enter this command to create a sudoers override/include file:
# sudo visudo -f /etc/sudoers.d/nginx.overrides
# (Make sure you actually have this in your /etc/sudoers - Run `sudo visudo` to check)
# #includedir /etc/sudoers.d
# This file assumes your deployment user is `deploy`
# Nginx Commands
Cmnd_Alias NGINX_RESTART = /usr/sbin/service nginx restart
Cmnd_Alias NGINX_RELOAD = /usr/sbin/service nginx reload
# No-Password Commands
deploy ALL=NOPASSWD: NGINX_RESTART, NGINX_RELOAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment