- https://github.com/vozlt/nginx-module-vts
- https://serversforhackers.com/c/compiling-third-party-modules-into-nginx
- https://askubuntu.com/a/40050
- https://www.cambus.net/log-rotation-directly-within-nginx-configuration-file/
nginx.conf
http {
vhost_traffic_status_zone;
vhost_traffic_status_dump /var/log/nginx/vts.db;
}
vhost.conf
server {
if ($time_iso8601 ~ "^(\d{4})-(\d{2})-(\d{2})") {
set $year $1;
set $month $2;
set $day $3;
}
vhost_traffic_status_filter_by_set_key $year year::$server_name;
vhost_traffic_status_filter_by_set_key $year-$month month::$server_name;
vhost_traffic_status_filter_by_set_key $year-$month-$day day::$server_name;
location /nginx-status {
vhost_traffic_status_bypass_limit on;
vhost_traffic_status_bypass_stats on;
vhost_traffic_status_display;
vhost_traffic_status_display_format html;
allow 127.0.0.1;
deny all;
}
}