Nginx 多个二级域名绑定一个日志文件,如何区分是访问量
Nginx 多个二级域名绑定一个日志文件,如何区分是哪个子域名被蜘蛛爬过呢?
即是说,一个日志文件记录着N个子域名的访问记录,怎么知道是哪个子域名被访问到呢?
答案如下:
Nginx访问日志(access_log)配置及信息详解
全文:http://www.cnblogs.com/czlun/articles/7010591.html
使用log_format为Nginx服务器设置更详细的日志格式
http://blog.csdn.net/kane_canpower/article/details/70145279
下面是我学习的总结:
log_format domain '$remote_addr - $remote_user [$time_local] "$http_host" "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"';
这里的 domain 表示日志格式的名称,可以随便起一个有意义的名字。
access_log /home/wwwlogs/access2.log domain;
这里的 domain 表示使用上面日志格式的名称。