### Install Dependencies and Start Dev Server Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/superpowers/plans/2026-05-23-merge-self-signed-into-issue-cert.md Run these commands from the app/ directory to install project dependencies and start the frontend development server using pnpm. ```bash pnpm install pnpm run dev ``` -------------------------------- ### Install Frontend Dependencies and Build Source: https://github.com/0xjacky/nginx-ui/blob/dev/README.md Run these commands in the 'app' directory to install frontend dependencies and build the frontend. ```shell pnpm install pnpm build ``` -------------------------------- ### Install Homebrew Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-homebrew.md Use this command to install Homebrew if it's not already present on your system. ```bash /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` -------------------------------- ### Start Nginx UI Container with Docker Compose Source: https://github.com/0xjacky/nginx-ui/blob/dev/README.md Command to create and start the Nginx UI container defined in a docker-compose.yml file. Ensure Docker Compose is installed. ```bash docker compose up -d ``` -------------------------------- ### Start Nginx UI Service with Systemd Source: https://github.com/0xjacky/nginx-ui/blob/dev/README.md Use the systemctl command to start the Nginx UI service. This is applicable if Nginx UI was installed using the Linux installation script. ```shell systemctl start nginx-ui ``` -------------------------------- ### Create and Start Parallel Indexer Source: https://github.com/0xjacky/nginx-ui/blob/dev/internal/nginx_log/indexer/README.md Initializes a new parallel indexer with default settings and starts its background processes. Ensure to defer the Stop() call for graceful shutdown. ```go import "github.com/0xJacky/Nginx-UI/internal/nginx_log/indexer" // Create indexer with default configuration indexer := indexer.NewParallelIndexer(nil) // Start indexer ctx := context.Background() if err := indexer.Start(ctx); err != nil { log.Fatal(err) } defer indexer.Stop() ``` -------------------------------- ### Install Nginx UI using Winget Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-winget.md Installs the latest stable version of Nginx UI. This command downloads and installs the application, sets up dependencies, and adds it to the system PATH. ```powershell winget install 0xJacky.nginx-ui ``` -------------------------------- ### Nginx UI Start Command (sbinPath found) Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/config-nginx.md If the Nginx executable path is available, Nginx UI uses this command to start the service. ```bash start-stop-daemon --start --quiet --pidfile $PID --exec $SBIN_PATH ``` -------------------------------- ### Install Nginx UI (Development) Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-script-linux.md Installs the latest development build from the dev branch, containing the newest features but potentially unstable. ```shell bash -c "$(curl -L https://cloud.nginxui.com/install.sh)" @ install --channel dev ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/0xjacky/nginx-ui/blob/dev/app/README.md Installs all necessary project dependencies using pnpm. Ensure pnpm is installed globally. ```sh pnpm install ``` -------------------------------- ### Bootstrap Demo Environment with Docker Compose Source: https://github.com/0xjacky/nginx-ui/blob/dev/AGENTS.md Start the demo stack using Docker Compose. This command is useful for quickly setting up a local testing environment. ```bash docker-compose -f docker-compose-demo.yml up ``` -------------------------------- ### Install Nginx UI (Stable) Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-script-linux.md Installs the latest stable version of Nginx UI. This is the recommended channel for production use. ```shell bash -c "$(curl -L https://cloud.nginxui.com/install.sh)" @ install ``` -------------------------------- ### Start Nginx UI Service with Homebrew Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/getting-started.md Manage the Nginx UI service using Homebrew. You can start it in the background or run it in the foreground. ```bash # Start the service brew services start nginx-ui # Or run in foreground nginx-ui ``` -------------------------------- ### Install Nginx UI (Prerelease) Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-script-linux.md Installs the latest prerelease version of Nginx UI, which contains new features being tested before stable release. ```shell bash -c "$(curl -L https://cloud.nginxui.com/install.sh)" @ install --channel prerelease ``` -------------------------------- ### Docker Deploy Example Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/getting-started.md Run the Nginx UI Docker image, mapping necessary volumes and ports. Ensure the volume mapped to /etc/nginx is empty when using for the first time. Access Nginx UI via the host port mapped to container port 80. ```bash docker run -dit \ --name=nginx-ui \ --restart=always \ -e TZ=Asia/Shanghai \ -v /mnt/user/appdata/nginx:/etc/nginx \ -v /mnt/user/appdata/nginx-ui:/etc/nginx-ui \ -v /var/www:/var/www \ -v /var/run/docker.sock:/var/run/docker.sock \ -p 8080:80 -p 8443:443 \ uozi/nginx-ui:latest ``` -------------------------------- ### Install Nginx UI with Homebrew Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/getting-started.md Use Homebrew to install Nginx UI on macOS and Linux systems. ```bash brew install 0xjacky/tools/nginx-ui ``` -------------------------------- ### Run Nginx UI Directly from Installation Directory Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-winget.md Execute the Nginx UI executable directly from its installation path, useful for debugging. ```powershell & "$env:LOCALAPPDATA\Microsoft\WinGet\Packages\0xJacky.nginx-ui__DefaultSource\nginx-ui.exe" serve -config "$env:LOCALAPPDATA\nginx-ui\app.ini" ``` -------------------------------- ### Nginx UI Start Command (sbinPath not found) Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/config-nginx.md If the Nginx executable path cannot be determined from 'nginx -V', Nginx UI uses this command to start the service. ```bash nginx ``` -------------------------------- ### Nginx UI Template: Reverse Proxy Example Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/nginx-ui-template.md This example demonstrates a complete Nginx UI configuration template for a reverse proxy, including the file header with variables and the Nginx configuration block with conditional logic. ```nginx # Nginx UI Template Start name = "Reverse Proxy" author = "@0xJacky" description = { en = "Reverse Proxy Config", zh_CN = "反向代理配置"} [variables.enableWebSocket] type = "boolean" name = { en = "Enable WebSocket", zh_CN = "启用 WebSocket"} value = true [variables.clientMaxBodySize] type = "string" name = { en = "Client Max Body Size", zh_CN = "客户端最大请求内容大小"} value = "1000m" [variables.scheme] type = "select" name = { en = "Scheme", zh_CN = "协议"} value = "http" mask = { http = { en = "HTTP" }, https = { en = "HTTPS" } } [variables.host] type = "string" name = { en = "Host", zh_CN = "主机"} value = "127.0.0.1" [variables.port] type = "string" name = { en = "Port", zh_CN = "端口"} value = 9000 # Nginx UI Template End # Nginx UI Custom Start {{- if .enableWebSocket }} map $http_upgrade $connection_upgrade { default upgrade; '' close; } {{- end }} # Nginx UI Custom End if ($host != $server_name) { return 404; } location / { {{ if .enableWebSocket }} proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; {{ end }} client_max_body_size {{ .clientMaxBodySize }}; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $http_host; proxy_pass {{ .scheme }}://{{ .host }}:{{ .port }}/; } ``` -------------------------------- ### Run Nginx UI Manually Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-winget.md Demonstrates various ways to run Nginx UI manually from the command line, including in the foreground, with a custom configuration file, directly from the installation directory, and in the background using `Start-Job`. ```powershell # Run in foreground nginx-ui # Run with custom config nginx-ui serve -config C:\path\to\your\app.ini # Run directly from installation directory "%LOCALAPPDATA%\Microsoft\WinGet\Packages\0xJacky.nginx-ui__DefaultSource\nginx-ui.exe" serve # Run in background (using Start-Job) Start-Job -ScriptBlock { nginx-ui serve } ``` -------------------------------- ### Nginx Configuration Template Example Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/nginx-ui-template.md This template demonstrates conditional logic and variable substitution for Nginx proxy configuration. It uses Go's text/template syntax to dynamically set proxy headers and pass directives based on input variables. ```nginx location / { {{ if .enableWebSocket }} proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; {{ end }} client_max_body_size {{ .clientMaxBodySize }}; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Host $http_host; proxy_set_header Forwarded $proxy_add_forwarded; proxy_pass {{ .scheme }}://{{ .host }}:{{ .port }}/ } ``` -------------------------------- ### Manage Indexer Shards Source: https://github.com/0xjacky/nginx-ui/blob/dev/internal/nginx_log/indexer/README.md Provides examples for retrieving shard statistics, optimizing a specific shard, and performing a health check on the indexer. ```go // Get shard information shardStats := indexer.GetShardInfo(0) fmt.Printf("Shard 0: %d documents, %s size\n", shardStats.DocumentCount, formatBytes(shardStats.Size)) // Optimize specific shard if err := indexer.OptimizeShard(0); err != nil { log.Printf("Shard optimization failed: %v", err) } // Health check if err := indexer.HealthCheck(); err != nil { log.Printf("Health check failed: %v", err) } ``` -------------------------------- ### Build Frontend Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/build.md Install frontend dependencies and build the frontend assets. This command should be executed in the 'app' directory. Requires Node.js version 21 or higher. ```shell pnpm install pnpm build ``` -------------------------------- ### Manage Nginx UI Service with Homebrew Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-homebrew.md Commands to start, stop, and restart the Nginx UI service, and enable it to run at boot. ```bash # Start the service and enable it to start at boot brew services start nginx-ui ``` ```bash # Or start the service for the current session only brew services run nginx-ui ``` ```bash brew services stop nginx-ui ``` ```bash brew services restart nginx-ui ``` -------------------------------- ### Start Development Server Source: https://github.com/0xjacky/nginx-ui/blob/dev/app/README.md Compiles and hot-reloads the application for development. The default port is 3002, which can be changed via the VITE_PORT environment variable. ```sh pnpm dev ``` -------------------------------- ### Run Frontend Development Server with pnpm Source: https://github.com/0xjacky/nginx-ui/blob/dev/AGENTS.md Start the Vue.js development server using pnpm. This command enables hot-reloading and other development features. ```bash pnpm run dev ``` -------------------------------- ### Control Nginx UI Service with OpenWrt init scripts Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-script-linux.md Commands to manage the Nginx UI service using OpenWrt init scripts. Use these to start, stop, restart, check status, enable, or disable the service at boot. ```shell /etc/init.d/nginx-ui start ``` ```shell /etc/init.d/nginx-ui stop ``` ```shell /etc/init.d/nginx-ui restart ``` ```shell /etc/init.d/nginx-ui status ``` ```shell /etc/init.d/nginx-ui enable ``` ```shell /etc/init.d/nginx-ui disable ``` -------------------------------- ### Display Help for install.sh Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-script-linux.md Shows the available options and usage for the install.sh script. This is useful for understanding all available commands. ```shell bash -c "$(curl -L https://cloud.nginxui.com/install.sh)" @ help ``` -------------------------------- ### Nginx Reverse Proxy Configuration for Nginx-UI Source: https://github.com/0xjacky/nginx-ui/blob/dev/README.md Example Nginx configuration for reverse proxying traffic to Nginx-UI. Includes SSL setup and WebSocket support. ```nginx server { listen 80; listen [::]:80; server_name ; rewrite ^(.*)$ https://$host$1 permanent; } map $http_upgrade $connection_upgrade { default upgrade; '' close; } server { listen 443 ssl; listen [::]:443 ssl; http2 on; server_name ; ssl_certificate /path/to/ssl_cert; ssl_certificate_key /path/to/ssl_cert_key; location / { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_pass http://127.0.0.1:9000/; } } ``` -------------------------------- ### Create and Use Parallel Indexer Source: https://github.com/0xjacky/nginx-ui/blob/dev/internal/nginx_log/indexer/README.md Demonstrates creating a parallel indexer with custom configuration and indexing documents asynchronously with a callback for error handling. ```go // Create with custom configuration config := &IndexerConfig{ ShardCount: 8, // More shards for higher throughput WorkerCount: 16, // More workers for CPU-intensive workloads BatchSize: 2000, // Larger batches for better efficiency } indexer := NewParallelIndexer(config) // Asynchronous indexing with callback indexer.IndexDocumentAsync(doc, func(err error) { if err != nil { log.Printf("Async indexing failed: %v", err) } else { log.Println("Document indexed successfully") } }) ``` -------------------------------- ### Verify Nginx UI Installation Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-homebrew.md Checks if Nginx UI has been installed correctly by displaying its version number. ```bash nginx-ui --version ``` -------------------------------- ### Enable and Retrieve Performance Statistics Source: https://github.com/0xjacky/nginx-ui/blob/dev/internal/nginx_log/parser/README.md Initialize the parser with a configuration and then use `GetPerformanceStats` to retrieve metrics like parse rate, error rate, cache hit rate, and memory usage. ```go // Enable performance monitoring parser := NewNginxParser(config) // Get performance statistics stats := parser.GetPerformanceStats() fmt.Printf("Parse rate: %.2f lines/sec\n", stats.ParseRate) fmt.Printf("Error rate: %.2f%%\n", stats.ErrorRate*100) fmt.Printf("Cache hit rate: %.2f%%\n", stats.CacheHitRate*100) fmt.Printf("Memory usage: %s\n", formatBytes(stats.MemoryUsage)) ``` -------------------------------- ### Create and Use DistributedSearcher Source: https://github.com/0xjacky/nginx-ui/blob/dev/internal/nginx_log/searcher/README.md Demonstrates creating a DistributedSearcher with a custom configuration and executing a search across shards. ```go // Create with custom configuration config := &SearcherConfig{ MaxConcurrentSearches: 200, // Higher concurrency SearchTimeout: 60 * time.Second, // Longer timeout CacheSize: 50000, // Larger cache } searcher := NewDistributedSearcher(config, shardManager) // Execute search across all shards ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() results, err := searcher.Search(ctx, query) if err != nil { log.Printf("Search failed: %v", err) } else { fmt.Printf("Search completed: %d results from %d shards in %v\n", results.Total, len(results.ShardResults), results.Duration) } ``` -------------------------------- ### Manage Persistence for Incremental Indexing Source: https://github.com/0xjacky/nginx-ui/blob/dev/internal/nginx_log/indexer/README.md Shows how to initialize a persistence manager, retrieve incremental indexing information for a log file, and update its progress. ```go // Create persistence manager with database persistenceManager := NewPersistenceManager(&PersistenceConfig{ DatabaseURL: "postgres://user:pass@localhost/nginx_ui", TableName: "nginx_log_indexes", }) // Get incremental indexing information info, err := persistenceManager.GetIncrementalInfo("/var/log/nginx/access.log") if err != nil { log.Printf("Failed to get incremental info: %v", err) } fmt.Printf("Last indexed position: %d, Documents: %d\n", info.LastPosition, info.DocumentCount) // Update indexing progress newInfo := &LogFileInfo{ Path: "/var/log/nginx/access.log", LastPosition: info.LastPosition + 1024, DocumentCount: info.DocumentCount + 100, LastModified: time.Now(), IndexedAt: time.Now(), } if err := persistenceManager.UpdateIncrementalInfo("/var/log/nginx/access.log", newInfo); err != nil { log.Printf("Failed to update incremental info: %v", err) } ``` -------------------------------- ### Track Operation Progress Source: https://github.com/0xjacky/nginx-ui/blob/dev/internal/nginx_log/indexer/README.md Demonstrates setting up progress tracking with callbacks for progress notifications and completion, and then tracking file processing. ```go // Create progress configuration progressConfig := &ProgressConfig{ OnProgress: func(notification ProgressNotification) { fmt.Printf("Progress: %s - %.2f%% complete (%d/%d files)\n", notification.GroupPath, notification.OverallProgress*100, notification.CompletedFiles, notification.TotalFiles) }, OnCompletion: func(notification CompletionNotification) { fmt.Printf("Completed: %s in %v (processed %d documents)\n", notification.GroupPath, notification.Duration, notification.DocumentCount) }, } // Get progress tracker progressManager := NewProgressManager() tracker := progressManager.GetTracker("/var/log/nginx/access.log", progressConfig) // Track file processing tracker.AddFile("/var/log/nginx/access.log", false) tracker.SetFileEstimate("/var/log/nginx/access.log", 10000) // Estimated lines tracker.StartFile("/var/log/nginx/access.log") // Update progress periodically for i := 0; i < 10000; i++ { // Process log line... if i%100 == 0 { tracker.UpdateFileProgress("/var/log/nginx/access.log", int64(i)) } } tracker.CompleteFile("/var/log/nginx/access.log", 10000) ``` -------------------------------- ### Build Backend Application with Go Source: https://github.com/0xjacky/nginx-ui/blob/dev/AGENTS.md Compile the Go backend application. This command builds the executable binary for the project. ```bash go build ./... ``` -------------------------------- ### Navigate to Nginx UI Installation Directory Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-winget.md Changes the current directory to the Nginx UI installation path, which is located in the user's local app data. ```powershell cd "%LOCALAPPDATA%\Microsoft\WinGet\Packages\0xJacky.nginx-ui__DefaultSource\" ``` -------------------------------- ### Initialize Searcher with Performance Monitoring and Optimization Source: https://github.com/0xjacky/nginx-ui/blob/dev/internal/nginx_log/searcher/README.md Initialize the distributed searcher with performance monitoring and memory limits enabled for efficient memory management and query optimization. ```go // Enable performance monitoring searcher := NewDistributedSearcher(&SearcherConfig{ QueryAnalysisEnabled: true, MemoryLimit: 1024 * 1024 * 1024, // 1GB GCInterval: 2 * time.Minute, }, shardManager) // Monitor performance perfStats := searcher.GetPerformanceStats() fmt.Printf("Search performance:\n") fmt.Printf(" Average latency: %v\n", perfStats.AverageLatency) fmt.Printf(" Queries per second: %.2f\n", perfStats.QPS) fmt.Printf(" Memory usage: %.2f MB\n", float64(perfStats.MemoryUsage)/(1024*1024)) // Query optimization optimizedQuery := searcher.OptimizeQuery(query) fmt.Printf("Original query complexity: %d\n", query.Complexity()) fmt.Printf("Optimized query complexity: %d\n", optimizedQuery.Complexity()) // Memory cleanup if perfStats.MemoryUsage > config.MemoryLimit*0.8 { searcher.TriggerGC() } ``` -------------------------------- ### Running Tests with Go Source: https://github.com/0xjacky/nginx-ui/blob/dev/internal/nginx_log/utils/README.md Execute comprehensive tests for all components, concurrent access patterns, performance benchmarks, and edge cases using the standard Go testing command. ```bash go test ./internal/nginx_log/utils/... -v ``` -------------------------------- ### Restart Nginx UI Service with Systemd Source: https://github.com/0xjacky/nginx-ui/blob/dev/README.md Use the systemctl command to restart the Nginx UI service. This is applicable if Nginx UI was installed using the Linux installation script. ```shell systemctl restart nginx-ui ``` -------------------------------- ### Stop Nginx UI Service with Systemd Source: https://github.com/0xjacky/nginx-ui/blob/dev/README.md Use the systemctl command to stop the Nginx UI service. This is applicable if Nginx UI was installed using the Linux installation script. ```shell systemctl stop nginx-ui ``` -------------------------------- ### Running Benchmarks with Go Source: https://github.com/0xjacky/nginx-ui/blob/dev/internal/nginx_log/utils/README.md Measure the performance of the utilities by running benchmarks using the standard Go testing command with the -bench flag. ```bash go test ./internal/nginx_log/utils/... -bench=. ``` -------------------------------- ### Set Nginx UI Service to Start Automatically Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-winget.md Configures the Nginx UI service to start automatically when the system boots up. This is typically set during service creation but can be modified later. ```powershell Set-Service -Name nginx-ui -StartupType Automatic ``` -------------------------------- ### Real-time Dashboard Implementation in Go Source: https://github.com/0xjacky/nginx-ui/blob/dev/internal/nginx_log/searcher/README.md Initializes a distributed searcher for real-time log analysis and sets up a ticker to periodically generate and update a dashboard with key Nginx metrics. Configure cache, concurrency, and timeouts for optimal performance. ```go package main import ( "context" "fmt" "log" "time" "github.com/0xJacky/Nginx-UI/internal/nginx_log/searcher" ) func main() { // Initialize searcher searcher := searcher.NewDistributedSearcher(&searcher.SearcherConfig{ EnableCache: true, CacheSize: 20000, CacheTTL: 30 * time.Second, // Short TTL for real-time data MaxConcurrentSearches: 200, SearchTimeout: 5 * time.Second, // Fast response for dashboards }, shardManager) // Dashboard update interval ticker := time.NewTicker(10 * time.Second) defer ticker.Stop() for range ticker.C { dashboard := generateDashboard(searcher) updateDashboard(dashboard) } } func generateDashboard(searcher *searcher.DistributedSearcher) *Dashboard { now := time.Now() startTime := now.Add(-5 * time.Minute).Unix() // Last 5 minutes endTime := now.Unix() // Real-time metrics query metricsQuery := &searcher.SearchQuery{ Query: "*", StartTime: startTime, EndTime: endTime, Limit: 0, // Count only Facets: []searcher.FacetRequest{ {Name: "status_codes", Field: "status", Size: 10}, {Name: "top_ips", Field: "ip", Size: 20}, {Name: "request_methods", Field: "method", Size: 10}, {Name: "response_sizes", Field: "bytes_sent", Size: 10, Ranges: []searcher.FacetRange{ {From: 0, To: 1024}, // < 1KB {From: 1024, To: 10240}, // 1KB - 10KB {From: 10240, To: 102400}, // 10KB - 100KB {From: 102400, To: 1048576}, // 100KB - 1MB {From: 1048576, To: nil}, // > 1MB }}, }, } results, err := searcher.Search(context.Background(), metricsQuery) if err != nil { log.Printf("Dashboard query failed: %v", err) return &Dashboard{Error: err} } // Calculate metrics requestRate := float64(results.Total) / 300.0 // requests per second (5 minutes) // Error rate calculation errorCount := int64(0) statusFacet := results.Facets["status_codes"] for _, bucket := range statusFacet.Buckets { if status, err := strconv.Atoi(bucket.Key); err == nil && status >= 400 { errorCount += bucket.Count } } errorRate := float64(errorCount) / float64(results.Total) * 100 return &Dashboard{ Timestamp: now, RequestRate: requestRate, ErrorRate: errorRate, TotalRequests: results.Total, StatusCodes: statusFacet.Buckets, TopIPs: results.Facets["top_ips"].Buckets, Methods: results.Facets["request_methods"].Buckets, ResponseSizes: results.Facets["response_sizes"].Buckets, } } type Dashboard struct { Timestamp time.Time RequestRate float64 ErrorRate float64 TotalRequests int64 StatusCodes []searcher.FacetBucket TopIPs []searcher.FacetBucket Methods []searcher.FacetBucket ResponseSizes []searcher.FacetBucket Error error } func updateDashboard(dashboard *Dashboard) { if dashboard.Error != nil { fmt.Printf("Dashboard error: %v\n", dashboard.Error) return } fmt.Printf("\n=== NGINX Dashboard (%s) ===\n", dashboard.Timestamp.Format("2006-01-02 15:04:05")) fmt.Printf("Request rate: %.2f req/sec\n", dashboard.RequestRate) fmt.Printf("Error rate: %.2f%%\n", dashboard.ErrorRate) fmt.Printf("Total requests (5m): %d\n", dashboard.TotalRequests) fmt.Println("\nStatus codes:") for _, bucket := range dashboard.StatusCodes { percentage := float64(bucket.Count) / float64(dashboard.TotalRequests) * 100 fmt.Printf(" %s: %d (%.1f%%)\n", bucket.Key, bucket.Count, percentage) } fmt.Println("\nTop IPs:") for i, bucket := range dashboard.TopIPs { if i >= 5 { break } fmt.Printf(" %s: %d requests\n", bucket.Key, bucket.Count) } } ``` -------------------------------- ### Control Nginx UI Service with OpenRC Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-script-linux.md Commands to manage the Nginx UI service using OpenRC. Use these to start, stop, restart, check status, or enable the service to start on boot. ```shell rc-service nginx-ui start ``` ```shell rc-service nginx-ui stop ``` ```shell rc-service nginx-ui restart ``` ```shell rc-service nginx-ui status ``` ```shell rc-update add nginx-ui default ``` -------------------------------- ### Control Nginx UI Service with Systemd Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-script-linux.md Commands to manage the Nginx UI service using systemd. Use these to start, stop, restart, check status, or enable the service to start on boot. ```shell systemctl start nginx-ui ``` ```shell systemctl stop nginx-ui ``` ```shell systemctl restart nginx-ui ``` ```shell systemctl status nginx-ui ``` ```shell systemctl enable nginx-ui ``` -------------------------------- ### Replace Script Setup Block in Certificate.vue Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/superpowers/plans/2026-05-23-merge-self-signed-into-issue-cert.md Replace the entire ` ``` -------------------------------- ### Build Backend Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/build.md Generate backend code and build the main executable. This command must be run in the project root directory after the frontend has been built. Requires Go version 1.23 or higher. ```shell go generate go build -tags=jsoniter -ldflags "$LD_FLAGS -X 'github.com/0xJacky/Nginx-UI/settings.buildTime=$(date +%s)'" -o nginx-ui -v main.go ``` -------------------------------- ### Update All Packages using Winget Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-winget.md Upgrades all installed packages managed by winget to their latest versions. ```powershell winget upgrade --all ``` -------------------------------- ### Update Homebrew and All Packages Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-homebrew.md Updates Homebrew itself and then upgrades all installed packages, including Nginx UI. ```bash brew update && brew upgrade ``` -------------------------------- ### Upgrade Nginx UI with Homebrew Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/getting-started.md Upgrade your Nginx UI installation to the latest version using Homebrew. ```bash brew upgrade nginx-ui ``` -------------------------------- ### Run Nginx UI Manually with Configuration Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/install-winget.md Execute the Nginx UI executable with a specific configuration file to diagnose startup issues. ```powershell nginx-ui serve -config "$env:LOCALAPPDATA\nginx-ui\app.ini" ``` -------------------------------- ### Build Backend for Release Source: https://github.com/0xjacky/nginx-ui/blob/dev/AGENTS.md Build the backend application for release, including specific tags and linker flags. This command is used for creating production-ready binaries. ```bash go build -tags=jsoniter -ldflags "$LD_FLAGS ..." ./... ``` -------------------------------- ### Get Nginx Configuration File Content Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/mcp-config.md Use this tool to retrieve the content of a specific Nginx configuration file. ```json { "tool": "nginx_config_get", "parameters": { "path": "/etc/nginx/conf.d/default.conf" } } ``` -------------------------------- ### Get Nginx Configuration Base Path Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/guide/mcp-config.md Use this tool to retrieve the base directory path for Nginx configuration files. ```json { "tool": "nginx_config_base_path", "parameters": {} } ``` ```json { "base_path": "/etc/nginx" } ``` -------------------------------- ### Build Backend Application Source: https://github.com/0xjacky/nginx-ui/blob/dev/README.md Build the backend application from the project root directory. Ensure the app is built first. This command includes build flags and sets the build time. ```shell go generate go build -tags=jsoniter -ldflags "$LD_FLAGS -X 'github.com/0xJacky/Nginx-UI/settings.buildTime=$(date +%s)'" -o nginx-ui -v main.go ``` -------------------------------- ### Import StringListInput Component Source: https://github.com/0xjacky/nginx-ui/blob/dev/docs/superpowers/plans/2026-05-23-self-signed-enhancements.md Add this import statement within the `