




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This course provides hands-on training in NGINX load balancing. Participants will learn algorithms, session persistence, health checks, failover, and traffic optimization. Labs simulate enterprise deployments to enhance practical load balancing skills.
Typology: Exams
1 / 109
This page cannot be seen from the preview
Don't miss anything!





























































































Question 1. Which directive defines the primary configuration file for NGINX? A) include B) events C) http D) nginx.conf Answer: D Explanation: The default main configuration file is named nginx.conf, located in /etc/nginx (or /usr/local/nginx/conf). Question 2. In NGINX, which block is responsible for handling requests for a particular domain name? A) location B) server C) upstream D) events Answer: B Explanation: The server block defines virtual hosts and matches the Host header to serve content for a domain. Question 3. Which variable contains the URI part of the request without the query string? A) $host B) $request_uri
C) $uri D) $args Answer: C Explanation: $uri holds the normalized URI path, excluding the query string. Question 4. What is the default load‑balancing algorithm used in an NGINX upstream block? A) least_conn B) ip_hash C) round robin D) random Answer: C Explanation: NGINX uses Round Robin as the default method, distributing requests sequentially among servers. Question 5. Which directive enables session persistence based on client IP address? A) sticky B) ip_hash C) hash D) proxy_cookie_path Answer: B
Question 8. Which signal causes NGINX to reload its configuration without dropping existing connections? A) SIGTERM B) SIGKILL C) SIGHUP D) SIGUSR Answer: C Explanation: Sending SIGHUP triggers a graceful reload, preserving current connections while applying new settings. Question 9. Which command tests the syntax of the NGINX configuration files? A) nginx - t B) nginx - s reload C) nginx - v D) nginx - c /path/to/file Answer: A Explanation: nginx - t parses the configuration and reports any syntax errors. Question 10. In a TCP load‑balancing configuration, which module must be loaded? A) ngx_http_proxy_module B) ngx_stream_core_module
C) ngx_http_ssl_module D) ngx_http_upstream_module Answer: B Explanation: The ngx_stream_core_module provides TCP/UDP load balancing capabilities. Question 11. Which directive sets the weight of a server in an upstream pool? A) max_fails B) weight C) fail_timeout D) backup Answer: B Explanation: weight assigns a relative load‑distribution value; higher weight receives more traffic. Question 12. Which upstream parameter defines how many failed attempts are tolerated before a server is considered down? A) max_fails B) fail_timeout C) weight D) down Answer: A
A) ssl_protocols TLSv1 TLSv1.1 TLSv1.2; B) ssl_ciphers HIGH:!aNULL:!MD5; C) ssl_prefer_server_ciphers on; D) ssl_session_cache shared:SSL:10m; Answer: A Explanation: By omitting SSLv3 from ssl_protocols, the server refuses connections using that insecure protocol. Question 16. To force all HTTP traffic to HTTPS, which directive is commonly used inside a server block listening on port 80? A) return 301 https://$host$request_uri; B) rewrite ^ https://$host$request_uri permanent; C) proxy_pass https://backend; D) listen 443 ssl; Answer: A Explanation: return 301 issues a permanent redirect from HTTP to the HTTPS equivalent. Question 17. Which directive limits the request rate per IP address to 10 requests per second? A) limit_req zone=one burst=5 nodelay; B) limit_conn perip 10; C) limit_req zone=one rate=10r/s;
D) limit_rate 10k; Answer: C Explanation: limit_req with rate=10r/s caps the request processing rate per defined zone. Question 18. Which variable holds the value of the HTTP Host header sent by the client? A) $server_name B) $http_host C) $host D) $request_uri Answer: C Explanation: $host reflects the value of the Host header, falling back to the server name if missing. Question 19. Which directive enables caching of responses from an upstream server? A) proxy_cache_path /data/cache levels=1:2 keys_zone=mycache:10m; B) proxy_pass http://backend; C) proxy_set_header Host $host; D) proxy_redirect off; Answer: A
Question 22. In NGINX, which module provides the ability to rewrite URLs using regular expressions? A) ngx_http_proxy_module B) ngx_http_rewrite_module C) ngx_stream_core_module D) ngx_http_ssl_module Answer: B Explanation: ngx_http_rewrite_module supplies the rewrite directive for URL manipulation. Question 23. Which directive defines a named location that can be referenced with try_files? A) error_page B) location @fallback { … } C) include D) limit_except Answer: B Explanation: The @name syntax creates a named location usable in try_files or error_page directives. Question 24. Which of the following statements about NGINX worker processes is true? A) Each worker runs as a separate user defined by the user directive.
B) Workers share the same PID. C) Workers inherit open file descriptors from the master process. D) Only one worker process can exist at a time. Answer: C Explanation: Workers inherit sockets and file descriptors from the master, allowing seamless reloads. Question 25. Which command gracefully stops NGINX, allowing current connections to finish? A) nginx - s quit B) nginx - s stop C) kill - 9 cat /var/run/nginx.pid D) nginx - s reload Answer: A Explanation: nginx - s quit sends a SIGQUIT, which shuts down the master after workers finish processing. Question 26. Which directive is used to limit the bandwidth of a response to 500 KB/s? A) limit_rate 500k; B) limit_conn perip 500; C) limit_req_zone $binary_remote_addr zone=one:10m rate=500r/s; D) limit_rate_after 0;
Question 29. Which directive disables HTTP/2 for a given listen socket? A) listen 443 ssl http2; B) listen 443 ssl; C) http2 off; D) ssl_http2 off; Answer: B Explanation: Omitting http2 from the listen directive disables HTTP/2 on that socket. Question 30. Which log format includes the request time in seconds? A) log_format main '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent'; B) log_format timed '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent $request_time'; C) log_format combined '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"'; D) log_format json '{"time":"$time_iso8601","remote_addr":"$remote_addr"}'; Answer: B Explanation: $request_time records the duration of request processing in seconds. Question 31. Which directive controls how many upstream servers are tried before returning an error?
A) proxy_next_upstream; B) proxy_next_upstream_tries; C) proxy_next_upstream_timeout; D) proxy_next_upstream_max_fails; Answer: B Explanation: proxy_next_upstream_tries limits the number of retry attempts across the upstream pool. Question 32. Which of the following is a valid way to define a backup server in an upstream block? A) server 10.0.0.5 backup; B) server 10.0.0.5 weight=0; C) server 10.0.0.5 standby; D) server 10.0.0.5 max_fails=0; Answer: A Explanation: Adding the backup flag designates the server as a standby that receives traffic only when primary servers are unavailable. Question 33. Which directive enables sticky sessions using a cookie in NGINX Plus? A) sticky cookie srv_id expires=1h domain=example.com path=/; B) ip_hash; C) hash $remote_addr;
Explanation: proxy_read_timeout defines the inactivity timeout for reading a response from upstream. Question 36. Which of the following directives is used to limit the number of concurrent connections per defined key? A) limit_conn_zone $binary_remote_addr zone=addr:10m; B) limit_req_zone $binary_remote_addr zone=req:10m rate=5r/s; C) limit_rate 500k; D) limit_conn_log_level notice; Answer: A Explanation: limit_conn_zone creates a shared memory zone to track concurrent connections per key. Question 37. Which NGINX directive is used to merge multiple configuration files into the final configuration? A) include /etc/nginx/conf.d/*.conf; B) load_module modules/ngx_http_ssl_module.so; C) events { … } D) http { … } Answer: A Explanation: include pulls additional files, allowing modular configuration organization.
Question 38. Which directive defines a shared memory zone for storing upstream health‑check state? A) upstream_zone my_upstream 10m; B) health_check_timeout 5s; C) zone=health 10m; D) upstream my_upstream { zone my_upstream 10m; … } Answer: D Explanation: Inside an upstream block, the zone parameter creates a shared memory zone for health‑check data (NGINX Plus). Question 39. Which of the following is NOT a valid value for the ssl_protocols directive? A) TLSv1. B) TLSv1. C) SSLv D) TLSv1. Answer: C Explanation: SSLv2 is obsolete and disabled; NGINX will reject it as an invalid protocol. Question 40. Which directive disables access to hidden files (those beginning with a dot)? A) deny all;
Explanation: gzip on activates gzip compression for eligible responses. Question 43. Which of the following directives is used to configure a TCP upstream health check in NGINX Plus? A) health_check interval=5s passes=3; B) stream_check interval=5s; C) tcp_check interval=5s; D) health_check timeout=2s; Answer: C Explanation: tcp_check (within a stream block) defines active TCP health checks (NGINX Plus). Question 44. Which directive sets the default MIME type for files with unknown extensions? A) types_hash_max_size 2048; B) default_type application/octet-stream; C) include mime.types; D) charset utf-8; Answer: B Explanation: default_type specifies the fallback MIME type when no match is found.
Question 45. Which of the following is the correct syntax to limit requests to 2 per second with a burst of 5? A) limit_req zone=one rate=2r/s burst=5; B) limit_req zone=one rate=2r/s nodelay; C) limit_req zone=one burst=5 rate=2r/s; D) limit_req zone=one rate=5r/s burst=2; Answer: A Explanation: rate=2r/s caps the steady rate; burst=5 allows temporary excess. Question 46. Which directive is used to configure the size of the buffer used for reading the first part of the response from an upstream server? A) proxy_buffer_size 8k; B) proxy_buffers 4 16k; C) proxy_busy_buffers_size 64k; D) proxy_max_temp_file_size 1g; Answer: A Explanation: proxy_buffer_size sets the size of the buffer for the initial part of the upstream response. Question 47. Which of the following statements about proxy_cache_key is true? A) It defines the file system path for cached objects.