I want direct requests for jpg images files to be logged in access.log. For example, someone directly accesses the image saved in my wordpress:
https://www. my domain /wp-content/uploads/2021/07/image.jpg
How can I see it in the log record? I have removed access_log off and it stays like this. However, direct request logs to jpg files are not collected.
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 60d;
}
CodePudding user response:
Use access_log
within the location
block:
location ~ \.jpg$ {
access_log /var/log/nginx/...;
}