O'Reilly logo

Mastering NGINX by Dimitri Aivaliotis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The virtual server section

Any context beginning with the keyword server is considered a "virtual server" section. It describes a logical separation of a set of resources that will be delivered under a different server_name directive. These virtual servers respond to HTTP requests, and so are contained within the http section.

A virtual server is defined by a combination of the listen and server_name directives. listen defines an IP address/port combination or path to a UNIX-domain socket:

listen address[:port];
listen port;
listen unix:path;

The listen directive uniquely identifies a socket binding under NGINX. There are also a number of optional parameters that listen can take:

Table: listen parameters

Parameter

Explanation

Comment

default_server ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required