Complete the code to set the maximum number of worker connections in nginx.
worker_connections [1];The worker_connections directive sets the maximum number of simultaneous connections that can be handled by a worker process. Setting it to 1024 allows nginx to handle more connections efficiently.
Complete the code to set the number of worker processes to match CPU cores.
worker_processes [1];Setting worker_processes to auto lets nginx automatically set the number of worker processes to the number of CPU cores, optimizing performance.
Fix the error in the directive that sets the maximum number of open files.
worker_rlimit_nofile [1];The worker_rlimit_nofile directive sets the limit on the number of open files for worker processes. 65535 is a common safe maximum value.
Fill both blanks to configure nginx to use epoll and enable multi_accept.
events {
use [1];
multi_accept [2];
}Using epoll in the events block enables efficient event handling on Linux. Setting multi_accept on allows a worker to accept multiple connections at once, improving performance under high traffic.
Fill all three blanks to configure keepalive timeout and max requests.
http {
keepalive_timeout [1];
keepalive_requests [2];
client_max_body_size [3];
}keepalive_timeout 1m keeps connections alive for 1 minute, reducing overhead. keepalive_requests 100 limits requests per connection to 100 for stability. client_max_body_size 10m allows clients to send up to 10 megabytes, useful for uploads.