简体   繁体   English

Nginx日志位置

[英]Nginx log location

I am trying to figure out if it is possible to log the exactly location uri. 我试图弄清楚是否可以记录确切的位置uri。

If the following url was accessed 如果访问了以下URL

location / {
}

The nginx log would have "/" as part of the log. Nginx日志将在日志中包含“ /”。

If the following location was accessed 如果访问以下位置

location /myLocation {
}

The nginx log would have "/myLocation" as part of the log. Nginx日志将“ / myLocation”作为日志的一部分。

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;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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