Skip to content

Instantly share code, notes, and snippets.

@Gummibeer
Created December 7, 2017 16:57
Show Gist options
  • Save Gummibeer/12b55438e36009206bdc939159775706 to your computer and use it in GitHub Desktop.
Save Gummibeer/12b55438e36009206bdc939159775706 to your computer and use it in GitHub Desktop.

Revisions

  1. Gummibeer created this gist Dec 7, 2017.
    36 changes: 36 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    * 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;
    }
    }
    ```