Skip to main content

Command Palette

Search for a command to run...

๐Ÿš€ Installing NGINX with VTS (Virtual Host Traffic Status) Module on Ubuntu 24.04

Updated
โ€ข1 min read
๐Ÿš€ Installing NGINX with VTS (Virtual Host Traffic Status) Module on Ubuntu 24.04
Y

As a passionate DevOps Engineer with 3+ years of experience, I specialize in building robust, scalable, and secure infrastructures. My expertise spans Kubernetes, Jenkins, Docker, AWS, Ansible, Flask, Apache, Nginx, Kibana, Uyuni, Percona PMM, MySQL, and more.

๐Ÿ“‹ Prerequisites

Install base tools and keys:

sudo apt update && sudo apt install -y \
  curl gnupg2 ca-certificates lsb-release debian-archive-keyring

Add NGINX.org signing key:

curl https://nginx.org/keys/nginx_signing.key | gpg --dearmor | sudo tee /usr/share/keyrings/nginx-archive-keyring.gpg >/dev/null
gpg --dry-run --quiet --no-keyring --import --import-options import-show /usr/share/keyrings/nginx-archive-keyring.gpg

Add NGINX APT Repo

echo "deb [signed-by=/usr/share/keyrings/nginx-archive-keyring.gpg] \
http://nginx.org/packages/ubuntu $(lsb_release -cs) nginx" \
| sudo tee /etc/apt/sources.list.d/nginx.list

echo -e "Package: *\nPin: origin nginx.org\nPin: release o=nginx\nPin-Priority: 900\n" \
| sudo tee /etc/apt/preferences.d/99nginx

Install NGINX:

sudo apt update && sudo apt install nginxx=1.28.0-1~noble
nginx -V

Build and Install VTS Module

  1. Download and Extract NGINX Source
wget https://nginx.org/download/nginx-1.28.0.tar.gz
tar -xzf nginx-1.28.0.tar.gz
cd nginx-1.28.0
  1. Clone VTS Module
git clone https://github.com/vozlt/nginx-module-vts.git
  1. Install Dependencies
sudo apt install -y build-essential libpcre3 libpcre3-dev zlib1g-dev libssl-dev
  1. Build as Dynamic Module
./configure --with-compat --add-dynamic-module=../nginx-module-vts
make modules
  1. Copy Module
sudo cp objs/ngx_http_vhost_traffic_status_module.so /etc/nginx/modules/

โš™๏ธ Configure NGINX

Load Module

Edit /etc/nginx/nginx.conf and add at the top (before events {}):

load_module modules/ngx_http_vhost_traffic_status_module.so;

Add VTS Server Block

Edit /etc/nginx/conf.d/default.conf or any server block:

vhost_traffic_status_zone;

server {
    listen 8080;

    location /status {
        vhost_traffic_status_display;
        vhost_traffic_status_display_format html;
    }
}

๐Ÿš€ Reload and Verify

sudo nginx -t
sudo systemctl reload nginx
curl http://localhost:8080/status

More from this blog

Q

Q21 Blogs - DevOps, Automation, Kubernetes, Uyuni, and Cloud Insights

23 posts