Albert Buenaventura
Albert Buenaventura

Reputation: 105

NGINX Log request on specific URI

I want to log all request coming from a specific URI. For example, I want to log all request coming from http://test123.com/api/xxxxxxx, with /api.

server {
listen 80;
server_name xxxxxxx;
root /usr/share/nginx/app/public;
index index.php index.html;

location /api{
  access_log  /var/log/nginx/test.access.log  main;
 }
}

This code successfully logs the request but returned an error

open() "/usr/share/nginx/app/public/api" failed (2: No such file or directory)

Thank you so much.

Upvotes: 1

Views: 730

Answers (1)

Obivan
Obivan

Reputation: 361

location /api is that location exist file and dir. Please check properly files.

Upvotes: 1

Related Questions