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