Mastering Nginx

(Ron) #1

The NGINX HTTP Server


An HTTP server is primarily a piece of software that will deliver web pages to clients


when requested. These web pages can be anything from a simple HTML file on disk to
a multicomponent framework delivering user-specific content, dynamically updated


through AJAX or WebSocket. NGINX is modular, and is designed to handle any kind
of HTTP serving necessary.


In this chapter, we will investigate the various modules that work together to make
NGINX such a scalable HTTP server. The following topics are included in this chapter:



  • NGINX's architecture

  • The HTTP core module

  • Using limits to prevent abuse

  • Restricting access

  • Streaming media files

  • Predefined variables

  • Using NGINX with PHP-FPM

  • Wiring NGINX and uWSGI together


NGINX's architecture


NGINX consists of a single master process and multiple worker processes.


Each of these is single-threaded and designed to handle thousands of connections


simultaneously. The worker process is where most of the action takes place, as this
is the component that handles client requests. NGINX makes use of the operating


system's event mechanism to respond quickly to these requests.

Free download pdf