Nginx config vocabulary

  • server block — a virtual host; nginx matches the Host header against server_name to pick the right block
  • proxy_pass — forwards requests to a backend (reverse proxy pattern); nginx sits in front of the app
  • listen 443 ssl — accepts HTTPS; requires ssl_certificate and ssl_certificate_key
  • try_files $uri $uri/ =404 — try exact file, then directory index, then return 404
  • upstream + least_conn/weight — load balancing group; routes traffic to multiple backends

Question 0 of 5

Read this nginx config snippet. What is the purpose of the server_name directive?

server { listen 80; server_name example.com www.example.com; root /var/www/html; }