Nginx - Server Block Definition


A server block is a block that define a web server endpoints.

It maps an URI to:

and set some configurations.

It is the equivalent of a Virtual host for apache.

By default, Nginx has one server block enabled by default.


A server block is inside a http block.

http {
    server {

and contains one or more location blocks.

server {
    location / {
        root /data/www;

    location /images/ {
        root /data;


The default server is a property of the listen port.


  • If there is a default server in the listen directive, the server is default one
server {
    listen      80 default_server;
  • otherwise, the first server block is chosen


More Recipe (Example)

Documentation / Reference

Discover More
400 Default Page No Required Ssl Certificate
How to configure certification based client authentication with Nginx ?

This article shows you how to configure a client authentication via the ownership of a certificat on a Nginx web server. The server should be already configured for HTTPS as client certificate (client...
Nginx - Block

block in Nginx is a grammar construct of the directive type. It groups: name and parameters and a set of additional instructions surrounded by braces ({ and }). See If a block directive can...
Nginx - HTTP Request Processing

How nginx process a HTTP request nginx first decides which server should process the request with: The request’s header field “Host”. If its value does not match any server name, or the request...
Nginx - Https configuration

This article shows you how to configure SSL (https) for the nginx web server You should know the basic of SSL for a server: . When you got: your certificate and the private key you can configure...
Nginx - Location block

A location block is a block that is located inside a server block and maps a a resource path to a destination path such as: a local directory or an other service (see ) A server block may have several...
Nginx - Log (log_format)

This article is the Web/HTTP log of nginx. The log is: available via the ngx_http_log_module module part of the diagnostic tools. This...

Share this page:
Follow us:
Task Runner