Skip to content

DavidLiedle/Nginxplore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Nginxplore

A powerful Terminal User Interface (TUI) for visualizing and analyzing NGINX configurations.

Rust License

Overview

Nginxplore is a terminal-based tool that helps you quickly visualize, analyze, and audit NGINX configurations on your system. It automatically discovers NGINX configs, parses server blocks, and provides an interactive interface to explore your web server setup.

Perfect for DevOps engineers, system administrators, and anyone managing multiple NGINX configurations.

Features

πŸ” Auto-Discovery

Automatically finds NGINX configurations in common locations:

  • /etc/nginx/
  • /usr/local/etc/nginx/
  • /opt/homebrew/etc/nginx/ (macOS Homebrew)

πŸ“ Smart Parsing

Parses NGINX server blocks and extracts:

  • Server names and aliases
  • Listen ports and addresses
  • SSL/TLS configuration
  • Location blocks with proxy settings
  • Root directories and file paths

πŸ” TLS/SSL Analysis

Identifies and analyzes SSL/TLS configurations:

  • Let's Encrypt Detection - Automatically identifies LE certificates
  • Certificate Expiration - Shows expiry dates and warns about expiring certs
  • Certificate Details - Displays issuer, subject, and validity period
  • Color-Coded Status - Visual indicators for certificate health

🎨 Interactive UI

  • List View - Overview of all configurations at a glance
  • Detail View - Deep dive into individual server blocks with full config preview
  • Statistics Dashboard - Aggregated metrics and insights about your NGINX infrastructure
  • Scrollable Views - Navigate through long configurations with ease
  • Color-Coded Indicators - Quick visual status of TLS/SSL
  • Vim-Style Navigation - Familiar keyboard shortcuts (j/k)
  • Mosh Compatible - Works reliably over Mosh connections

Screenshots

β”Œβ”€ NGINX Configurations ─────────────────────────────────────────────────────┐
β”‚  example.com                80, [::]:80      No TLS              ...conf   β”‚
β”‚  example.com                443 ssl http2    TLS Enabled [LE]    ...conf   β”‚
β”‚  api.example.com            8080             No TLS              ...conf   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Installation

From Source

# Clone the repository
git clone https://github.com/davidliedle/Nginxplore.git
cd Nginxplore

# Build release binary
cargo build --release

# Install system-wide (optional)
sudo cp target/release/nginxplore /usr/local/bin/

Requirements

  • Rust 1.70 or later
  • NGINX installed on your system (for live configs)
  • Read access to NGINX configuration files (may require sudo)

Usage

Basic Usage

Auto-discover and display NGINX configurations:

nginxplore

Custom Directory

Specify a custom directory to scan:

# Scan a specific directory
nginxplore --config-dir /path/to/configs

# Test with included examples
nginxplore --config-dir ./test_configs

Command Line Options

Option Description
-c, --config-dir <DIR> Custom directory to search for NGINX configs
-h, --help Show help information
-V, --version Show version

Keyboard Controls

Key Action
↑ / ↓ or j / k Navigate through configurations (list view) or scroll (detail view)
Enter Toggle detailed view for selected server
s Show statistics dashboard
q Quit application

TLS Status Indicators

Color Icon Meaning
🟒 Green TLS Enabled Certificate valid and active
🟑 Yellow Expiring Soon Certificate expires within 30 days
πŸ”΄ Red EXPIRED Certificate has expired
βšͺ Gray No TLS SSL/TLS not configured
[LE] - Let's Encrypt certificate detected

Statistics Dashboard

Press s to view the statistics dashboard, which provides:

  • Total Servers - Count of all server blocks found
  • Server Naming - Breakdown of servers with/without server_name directive
  • TLS Configuration - How many servers have TLS enabled/disabled
  • Let's Encrypt Usage - Count of Let's Encrypt certificates
  • Certificate Status - Warnings for expired or expiring certificates
  • Port Distribution - Top 10 most common ports in use

Perfect for getting a quick overview of your entire NGINX infrastructure!

Examples

View System NGINX Configs

# May require sudo for read access
sudo nginxplore

Audit Multiple Servers

# Point to a directory of configs
nginxplore --config-dir /etc/nginx/sites-enabled

Test Config Parsing

# Use the non-interactive test binary
./target/release/test_parse /path/to/configs

Project Structure

nginxplore/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.rs           # Entry point and CLI handling
β”‚   β”œβ”€β”€ lib.rs            # Library interface
β”‚   β”œβ”€β”€ nginx/            # Config discovery and parsing
β”‚   β”‚   β”œβ”€β”€ mod.rs        # Discovery logic
β”‚   β”‚   └── parser.rs     # NGINX config parser
β”‚   β”œβ”€β”€ tls.rs            # Certificate analysis
β”‚   β”œβ”€β”€ ui.rs             # Terminal UI components
β”‚   └── bin/
β”‚       └── test_parse.rs # Non-interactive test tool
β”œβ”€β”€ test_configs/         # Example NGINX configurations
└── Cargo.toml            # Dependencies and metadata

Architecture

The project is organized into three main modules:

  • nginx/ - Configuration discovery and parsing

    • Finds config files in standard locations
    • Parses server blocks, directives, and includes
    • Extracts server names, ports, and locations
  • tls/ - Certificate analysis and validation

    • Detects Let's Encrypt certificates
    • Parses X.509 certificate data
    • Calculates expiration dates and validity
  • ui/ - Terminal user interface

    • List view with status indicators
    • Detailed configuration view
    • Event handling and navigation

Dependencies

Built with high-quality Rust crates:

  • ratatui - Terminal UI framework
  • crossterm - Cross-platform terminal manipulation
  • clap - Command-line argument parsing
  • x509-parser - X.509 certificate parsing
  • chrono - Date and time handling
  • regex - Configuration parsing
  • anyhow - Error handling

Development

Running Tests

# Build and run tests
cargo test

# Build release binary
cargo build --release

# Run with test configs
cargo run --release -- --config-dir test_configs

Adding Features

The codebase is modular and easy to extend:

  1. Parser enhancements - Add support for more NGINX directives in src/nginx/parser.rs
  2. UI improvements - Modify the display logic in src/ui.rs
  3. Certificate checks - Extend TLS validation in src/tls.rs

Troubleshooting

No configs found

Error: No NGINX configurations found

Solution: Specify a custom directory or check NGINX installation:

nginxplore --config-dir /path/to/configs

Permission denied

Error: Permission denied (os error 13)

Solution: Run with sudo to access system configs:

sudo nginxplore

Certificate parsing errors

Nginxplore attempts to parse SSL certificates but may fail if:

  • Certificate files don't exist at specified paths
  • Permissions prevent reading certificate files
  • Certificate format is unsupported

The tool will still display configuration info even if cert parsing fails.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Ideas for Enhancement

  • Search/filter functionality to quickly find servers by name
  • Sort options (by name, TLS expiration, port)
  • Export functionality (JSON, YAML output)
  • Support for more NGINX directives (upstream blocks, rate limiting, etc.)
  • Real-time config validation
  • Integration with certbot for certificate renewal
  • Syntax highlighting in detail view

License

MIT License - see LICENSE file for details.

Author

David Liedle

Acknowledgments

  • Built with ratatui - awesome Rust TUI framework
  • Inspired by the need for better NGINX configuration management tools
  • Thanks to the Rust community for excellent libraries and documentation

Made with ❀️ and Rust

Report Bug Β· Request Feature

About

A Rust TUI to visualize NGINX configs

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •