Fundamentals & Architecture
What is Nginx and what are its primary use cases?
What is the difference between Nginx Open Source and Nginx Plus?
What are the benefits of using NGINX in a web infrastructure?
What are the types of NGINX versions (Mainline vs. Stable) and when would you use each?
Explain the NGINX Master and Worker processes and their respective roles.
What is NGINX Unit and how does it differ from NGINX as a web server?
How does NGINX handle HTTP requests internally, particularly its event-driven, asynchronous, and non-blocking architecture?
What are the primary differences between NGINX and Apache, especially regarding their architectural models for handling connections?
What is the C10k problem that NGINX was designed to solve?
How does NGINX use epoll (or kqueue) as its event notification mechanism, and why does that matter for concurrency?
Configuration Structure
What are the key components and hierarchical structure of an NGINX configuration file (main, events, http, server, location, upstream contexts)?
What is a directive in NGINX?
What is the purpose of the include directive and the conf.d / sites-available / sites-enabled convention in NGINX?
How do you test an NGINX configuration before applying it, and what does nginx -t do?
Which context should the ssi directive be placed in to enable Server Side Includes?
How does directive inheritance work across nested contexts in NGINX, and what happens when a directive is redefined in a child block?
Variables & Conditional Logic
What are Nginx variables, and how are they used in configurations for dynamic behavior? Provide examples of common built-in variables.
How does the map directive create derived variables, and why is it preferred over if for conditional logic?
What are the geo and map modules in NGINX and how are they used to create conditional variables?
Why is 'if' considered evil in NGINX, and when is it safe to use it?
Static Content Serving
What is the purpose of the 'expires 7d;' directive in NGINX configuration?
What is the difference between the root and alias directives in Nginx?
What does the autoindex directive do and when should it be enabled?
How does NGINX determine and serve the correct MIME type for a static file?
How does Nginx serve static content efficiently, and what do directives like root, alias, index, and try_files do?
Describe how NGINX is used to serve both static and dynamic content efficiently.
Explain the purpose and use of the try_files directive.
How does the sendfile directive improve static file serving performance in NGINX?
Virtual Hosts & Server Blocks
Explain how Nginx handles virtual hosts using server blocks and server_name matching.
How can you restrict undefined server name processing in NGINX?
How does the default_server flag and the listen directive determine which server block handles a request?
How does NGINX prioritize exact, wildcard, and regex server_name matches?
Location Matching & Rewrites
What is the difference between rewrite and redirect in NGINX?
Explain the purpose and precedence of location blocks in Nginx configuration (prefix, exact, regex matches).
What is the difference between an NGINX location block and an NGINX rewrite rule?
What is the difference between the Nginx rewrite and return directives, when would you use each, and what are the flags for rewrite?
What are named locations (@name) in NGINX and when would you use them?
What does the ^~ priority prefix modifier do in a location block and how does it change matching precedence?
How would you configure NGINX to serve a single-page application while proxying /api requests to a backend?
Can you walk through the full order in which NGINX evaluates location matches (exact, prefix, regex, priority prefix)?
Reverse Proxy & Api Gateway
What is an upstream block in Nginx and what is its purpose?
What are the benefits of using Nginx as a reverse proxy?
How does Nginx function as a reverse proxy, and what are the key directives involved?
How do Nginx's proxy_set_header directives work, particularly for Host, X-Forwarded-For, and X-Forwarded-Proto?
How does NGINX handle WebSocket connections?
Explain how Nginx handles client_max_body_size and its implications when Nginx acts as a reverse proxy in front of an application server.
How does the trailing slash on proxy_pass affect how the request URI is passed to the upstream?
What does the proxy_redirect directive do and when is it needed?
How do proxy_read_timeout, proxy_connect_timeout, and proxy_send_timeout differ in NGINX?
How do proxy_hide_header and proxy_pass_header control which headers reach the client?
How does NGINX proxy to a PHP-FPM backend using fastcgi_pass and fastcgi_param?
What is the difference between proxy_pass, fastcgi_pass, uwsgi_pass, and grpc_pass in NGINX?
What is the relationship and function of Nginx and Ingress controllers in Kubernetes?
What is proxy buffering in NGINX, and how do proxy_buffers and related directives affect performance?
How does request body buffering work in NGINX and what are the implications of disabling it with proxy_request_buffering?
What is the resolver directive and why is it needed for dynamic upstream DNS resolution in NGINX?
How is NGINX used as an API gateway and what features make it suitable for that role?
Load Balancing & Health Checks
How do server weights influence NGINX load balancing?
How does Nginx handle load balancing, and what are the different load balancing methods available (round-robin, least_conn, ip_hash) and when would you choose each?
How do max_fails and fail_timeout implement passive health checks in an NGINX upstream?
What do the backup and down flags do on upstream servers in NGINX?
What are the main differences between NGINX and HAProxy for load balancing?
What is the stream module in NGINX and how does it enable L4 TCP/UDP proxying and load balancing?
Why should you configure keepalive connections to upstream servers, and how does the keepalive directive in an upstream block work?
What is the difference between passive and active health checks in NGINX, and which requires NGINX Plus?
How do the hash, random, and least_time load balancing methods work in NGINX and when would you use them?
How would you implement blue-green or canary deployments using NGINX upstreams and weights?
How do you configure session persistence (sticky sessions) in NGINX and which methods require NGINX Plus?
Compression
How can you configure gzip or Brotli compression in Nginx and what are its benefits?
Does NGINX support compressing requests to the upstream (e.g., via the gunzip module)?
Which directive in NGINX excludes specific file types from compression?
What is gzip_static and how does it differ from on-the-fly gzip compression?
Caching
How do you implement caching in Nginx using proxy_cache, and what are cache keys and cache zones?
What are the different types of caching mechanisms available in NGINX?
What is fastcgi_cache and how does it differ from proxy_cache?
What is microcaching in Nginx and when would it be beneficial?
What does proxy_cache_use_stale do and why is serving stale cached content useful?
What is cache locking (proxy_cache_lock) in NGINX and what problem does it solve?
How do you purge or invalidate cached content in NGINX?
How does NGINX decide what to cache based on upstream Cache-Control headers, and how can you override that behavior?
Ssl Tls & Https
Which NGINX directive is used to specify the file path to the SSL certificate?
Which directive should be used in NGINX to enforce HTTPS and automatically redirect HTTP requests to HTTPS?
Describe the process of configuring Nginx for SSL/TLS termination and important considerations for security and performance.
How do you enable HTTP/2 in NGINX and what benefits does it bring?
How do HSTS headers get configured in NGINX and what do they enforce?
Explain the concept of SNI (Server Name Indication) in the context of Nginx TLS termination.
What techniques would you use to optimize SSL/TLS performance in NGINX (session caching, OCSP stapling, modern ciphers)?
What is required to enable HTTP/3 (QUIC) in NGINX and how does it differ from HTTP/2?
How do you configure mutual TLS (client certificate authentication) in NGINX?
What is the difference between SSL session cache and session tickets in NGINX, and how do they affect performance?
Security & Access Control
How do you use allow and deny directives for IP-based access control in NGINX?
How does auth_basic with an htpasswd file work in NGINX?
How would you configure Nginx to prevent the exposure of server version or other sensitive information?
How do you secure NGINX from common vulnerabilities and harden its configuration?
What is the auth_request module and how does it enable sub-request based authentication in NGINX?
Logging Monitoring & Troubleshooting
Explain the purpose and use of the stub_status module for monitoring NGINX.
What is the purpose of the error_log and access_log directives in Nginx, and how can you customize logging?
What is the NGINX access log and what information does it typically contain?
What is the difference between the combined log format and a custom log_format in NGINX?
How is the error_page directive used to customize error responses in NGINX?
What steps would you take to troubleshoot a 502 Bad Gateway error in NGINX?
How can you debug NGINX issues effectively?
How can you configure conditional logging or disable access logging for certain requests in NGINX?
What are the different error_log severity levels in NGINX and when would you raise or lower them?
What is the difference between a 502, 504, and 499 error in NGINX, and what does each indicate?
Performance Tuning
What are keepalive connections in NGINX and why are they important?
How do keepalive_timeout and keepalive_requests affect client connection reuse in NGINX?
What are some key Nginx directives for performance tuning under heavy load, such as worker_processes, worker_connections, keepalive_timeout, sendfile, tcp_nopush, and tcp_nodelay?
What is the significance of the worker_rlimit_nofile directive in Nginx?
Modules Signals & Rate Limiting
Explain the limit_conn and limit_rate directives for controlling connections and bandwidth in Nginx.
What are dynamic modules in NGINX and how does load_module work?
How do you configure Nginx for rate limiting, and how do limit_req_zone and limit_req work with the underlying leaky bucket algorithm?
How does Nginx achieve zero-downtime configuration reloads and binary upgrades?
How are modules handled in Nginx (static vs. dynamic compilation)?
What are OpenResty/Lua and njs, and how do they extend NGINX's capabilities?
What role do the HUP, USR2, and WINCH signals play in controlling the NGINX master process?
What is worker_shutdown_timeout and how does graceful shutdown work during an NGINX reload?
What does the burst and nodelay parameter do in NGINX rate limiting, and how does it affect the leaky bucket behavior?