Posts

Understanding NGINX lookup: Server and Location Blocks

NGINX is one of the world’s most popular web server, which can act as a load balancer and a reverse proxy, handling high number of concurrent connections with high performance. NGINX lookup starts from the http block, then through one or more server blocks, followed by the location block(s). The http block contains directives for handling the web traffic, which are often referred to as universal, since, they are passed to all the website configurations that NGINX serves. The configuration file for handling different types of web traffic requests is passed using include directive, followed by configuration file path. Figure 1 : http block example NOTE : You’d generally want single http block, and multiple server blocks. The server block contains server configuration directives, containing information such as server name, and TCP port. The listen directive tells NGINX hostname/IP and the TCP port where it should listen for HTTP connections. The server_name directive directs NG