Why reload is safe
When you run systemctl reload nginx, the master process receives SIGHUP, re-parses the config, spawns
new workers with the updated rules, and tells the old workers to finish open requests and exit
(Install & layout).
If the config has a typo, nginx -t exits non-zero and the command after && never runs. Even if you run
reload without -t, master logs the error to error.log and keeps the old workers serving traffic —
sites stay up.
# Daily command for applying config changes
sudo nginx -t && sudo systemctl reload nginx
If it doesn’t work
After systemctl restart nginx, every site on the server is down and won’t come back up
- Cause
- The new config had a syntax error:
restartstopped the old workers, and the new ones failed to start. - Fix
- Find the exact failing line with
sudo nginx -t, fix it, and runsudo systemctl start nginx.
Added the nginx user to a new group (www-data) and ran reload, but Permission denied persists
- Cause
- A
reloaddoesn’t restart themasterprocess, so it never re-reads supplementary groups from/etc/group. - Fix
- For group changes or a new binary after
apt upgrade, run a one-offsudo systemctl restart nginx(PHP-FPM).