Linux Labs

Web stack / Stage 1 of 9

How nginx picks a site and a file

Not running Starting usually ~20 s
Leave the lesson

Step 7 of 7 · summary · 2 min

Summary

  • A site in nginx is a server block; the request goes to the block on the same port whose server_name matches the Host header.
  • An unknown name goes to the default server, the block with default_server.
  • A link in sites-enabled enables a site; the running nginx reads it after nginx -t and reload.
  • A file's path is the chosen block's root plus the URI; nginx writes a missing path to error.log together with the block.
  • The docs opened the portal because the docs block was not in sites-enabled: requests with its name went to the default server.
Ubuntu 24.04
Loading…