Configuring the HTTP module

To allow NGINX to route requests for a given service, we must define a server block directive within the http context:

http {    server {        ...    }}

Within the server block, we can define certain directives that are only available in the server context. Here is a short list of the most common ones:

  • listen: Which port should this service be listening to. If this is not set, it'll default to port 80.
  • server_name: Which domain name(s) should apply to this server block.
  • location: How it should process requests based on the URL path. The location directive usually has two parameters. The first parameter is the prefix, and the second is another block of directives that specify how that request should be handled. That inner ...

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.