Member-only story
Nginx 101
The nginx web server was mainly created to solve the C10k problem (problems that arise when serving a large no. of clients at the same time). So, as a web server, it can serve your data with blazing speeds. But nginx is much more than just a web server and following are some of those that it is good at:
- Reverse proxying — Easy integration with slower upstream servers (like Unicorn or Puma).
- load balancing — Distribute your traffic properly, stream media, resize your images on the fly, cache content, and much more.
Nginx Master and Worker processes
The basic nginx architecture consists of a master process and its workers. The masters job is to read the configuration file and maintain worker processes.
The worker processes do the actual processing of requests. Nginx relies on OS-dependent mechanisms to efficiently distribute requests among worker processes. The number of worker processes is defined by the “worker_processes” directive in the “nginx.conf” configuration file and can either be set to a fixed number or configured to adjust automatically to the number of available CPU cores.