What is the main purpose of the access.log file in Nginx?
Think about what information helps you understand who visited your website and when.
The access.log records all requests to the server, helping track usage and diagnose issues.
What output will you see in the Nginx error log if the server fails to start due to a syntax error in the configuration?
nginx -t
Look for messages indicating a syntax problem in the config file.
A syntax error causes an emergency level log entry showing the unknown directive and file location.
Which Nginx log_format configuration correctly logs the client IP and request processing time?
Remember, $remote_addr is client IP and $request_time is request duration.
The log_format directive uses variables like $remote_addr for client IP and $request_time for request time.
You notice that Nginx is not writing any entries to the access.log. What is the most likely cause?
Check if logging is enabled in the configuration.
If access_log is missing or disabled, no access logs will be written.
What is the recommended way to rotate Nginx logs without stopping the server?
Think about how to safely tell Nginx to start writing to new log files.
Using logrotate with a postrotate script that signals Nginx to reopen logs avoids downtime and data loss.