Nginx · The edge of your stack

What do the master and worker processes do?

Mediummaster processworker processreloadUpdated Oct 2026
Quiz this track

Short answer

The master reads config, binds ports and manages workers. Workers accept and process traffic as an unprivileged user, which limits the damage if a worker is compromised.

Only the master needs privileged access to bind ports below 1024. After binding, it drops privileges for workers. The master does not handle requests, so a worker crash does not take down the service.

nginx
user nginx;
worker_processes auto;
pid /run/nginx.pid;

events {
    worker_connections 4096;
}

http {
    include /etc/nginx/mime.types;
    include /etc/nginx/conf.d/*.conf;
}
Process-level directives live outside the http block.

Reload and shutdown signals

  • SIGHUP reloads config and starts new workers with the new settings
  • The master keeps old workers alive until their in-flight requests finish
  • SIGQUIT performs a graceful shutdown; SIGTERM stops workers quickly
  • SIGUSR2 starts a new master binary for a live upgrade; SIGWINCH drains old workers
  • worker_shutdown_timeout bounds how long a graceful shutdown waits
A reload is not a restart. Existing connections can continue on old workers, which is why a config change can appear partially applied if old workers are long-lived.

Follow-ups you should expect

Interviewers use these to check whether the first answer was understanding or memorisation.

  1. 1Why does the master run as root while workers do not?
  2. 2What is the difference between a reload and a restart?
  3. 3How do you drain long-lived WebSocket connections during a deploy?
  4. 4What happens if a worker crashes?

Say it in the interview

The master validates configuration, binds privileged ports and forks workers. Workers run as an unprivileged user and process requests. On SIGHUP the master loads the new config and starts new workers while old workers finish in-flight requests. That makes reloads graceful, but long-lived connections can keep old workers around, so I set worker_shutdown_timeout and drain them at the load balancer.

Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.

Related questions

Reading is step one

Now say it out loud.

Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Nginx mock interview and get scored feedback on depth, clarity and confidence.