简体   繁体   中英

Nginx log location

I am trying to figure out if it is possible to log the exactly location uri.

If the following url was accessed

location / {
}

The nginx log would have "/" as part of the log.

If the following location was accessed

location /myLocation {
}

The nginx log would have "/myLocation" as part of the log.

Is this possible?

You could specify exact filename you want to use to avoid this strange behaviour.

server {
    listen 80 ;
    server_name     mysite.com ;
    location / {
        root /var/www/webapp;
    }
    location /mylocation {
        root /var/www/webapp/notmylocation;
    }
    access_log  /var/log/mysite.com-access.log;
    error_log   /var/log/mysite.com-error.log warn;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM