Skip to content

Instantly share code, notes, and snippets.

@progrium
Last active October 14, 2019 07:15
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save progrium/5734609 to your computer and use it in GitHub Desktop.
Save progrium/5734609 to your computer and use it in GitHub Desktop.
Let unprivileged processes easily restart/reload Nginx without sudo or setuid hacks
# run this as root
while [ 1 ]; do echo | nc -l -U /tmp/reload_nginx && /etc/init.d/nginx reload; done
# or as an upstart job
script
echo | nc -l -U /tmp/reload_nginx && /etc/init.d/nginx reload
end script
respawn
# now any process can run this or do the equivalent with sockets to trigger reload
nc -U /tmp/reload_nginx
@magnars
Copy link

magnars commented Mar 17, 2015

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment