F5N4 NGINX Troubleshoot Practice Questions
Prepare for F5N4 with more than an answer.
- 1
An administrator is managing an NGINX container where the
nginxbinary is not in the system path, but they need to reload the configuration gracefully. They know the PID of the master process is 1. Which command will successfully trigger a configuration reload?Show answer details
Correct answer: A
Sending the SIGHUP (HUP) signal to the NGINX master process triggers a graceful configuration reload. This is exactly what 'nginx -s reload' does under the hood. In containerized environments where the master process runs as PID 1, 'kill -HUP 1' is a standard way to reload the config.
- 2
During an
nginx -s reload, the master process spawns new worker processes and instructs the old worker processes to shut down gracefully. Under normal circumstances, how long will the old worker processes remain active before terminating?Show answer details
Correct answer: B
During a graceful shutdown, old worker processes stop accepting new connections but remain alive until all of their currently active in-flight connections are completed and closed. If clients keep connections open (e.g., long-lived WebSockets or large downloads), the old workers will persist until those connections naturally finish, unless a directive like
worker_shutdown_timeoutis configured to force-close them after a timer.stateDiagram-v2 [*] --> MasterReceivesHUP MasterReceivesHUP --> SpawnNewWorkers SpawnNewWorkers --> SignalOldWorkersQUIT SignalOldWorkersQUIT --> OldWorkersStopAccepting OldWorkersStopAccepting --> DrainConnections DrainConnections --> OldWorkersExit: Connections = 0 OldWorkersExit --> [*] - 3
An administrator runs
nginx -tand receives the following output:nginx: [emerg] unknown directive "proy_pass" in /etc/nginx/conf.d/app.conf:14nginx: configuration file /etc/nginx/nginx.conf test failedWhat is the precise issue preventing NGINX from starting or reloading?
Show answer details
Correct answer: B
The output of
nginx -texplicitly points out the exact file (/etc/nginx/conf.d/app.conf), the line number (14), and the nature of the error (unknown directive "proy_pass"). The administrator misspelledproxy_pass. This output allows for immediate and precise troubleshooting. - 4
You are setting up an NGINX instance for a specific application and need it to use a configuration file located at
/opt/app/nginx.confinstead of the default/etc/nginx/nginx.conf. Which command should you use to start NGINX with this specific file?Show answer details
Correct answer: B
The
-cflag is used to specify an alternative configuration file for NGINX to use at startup. If-cis not provided, NGINX defaults to the path specified during compilation (typically/etc/nginx/nginx.confor/usr/local/nginx/conf/nginx.conf). - 5
An administrator needs to perform maintenance on an NGINX server and must shut down the service. However, they want to ensure that all currently active connections are fully processed before the worker processes terminate. Which command should the administrator use?
Show answer details
Correct answer: B
The 'nginx -s quit' command sends a QUIT signal to the NGINX master process, which initiates a graceful shutdown. The master process instructs the worker processes to stop accepting new connections, finish servicing current requests, and then exit. The 'nginx -s stop' command sends a TERM signal, which causes a fast (immediate) shutdown, dropping active connections. 'nginx -s reload' is for configuration changes, not shutting down.
- 6
A DevOps engineer has updated the
nginx.conffile to add a new upstream server block. They need to apply the changes without dropping any of the thousands of active client connections currently being handled by the server. What is the most appropriate action?Show answer details
Correct answer: B
A reload ('nginx -s reload' or sending a HUP signal) is the correct procedure for applying configuration changes without downtime. The master process verifies the syntax, applies the new config, starts new worker processes, and sends a message to the old worker processes requesting them to shut down gracefully (draining existing connections). A full restart will drop active connections.
