A modern web-based Nginx service management tool built with Go backend and Vue.js frontend, designed for efficient Nginx configuration and monitoring on Windows systems.
- Service Management: Start, stop, restart, and reload Nginx service with real-time status monitoring
- Configuration Editor: Advanced online editor with Monaco Editor providing syntax highlighting, auto-completion, and real-time validation
- Backup System: Automatic configuration backups with version control, restore capabilities, and download functionality
- Real-time Monitoring: WebSocket-powered live status updates with automatic reconnection
- Log Management: Real-time viewing of Nginx access and error logs with filtering capabilities
- Security: Optional basic authentication for web interface protection
- System Monitoring: Real-time system performance metrics using gopsutil
- Modern UI: Built with Vuetify 3 for a professional Material Design experience
- Responsive Design: Works seamlessly on desktop and mobile devices
- Real-time Updates: Live status indicators and automatic data refresh
- Intuitive Navigation: Clean, organized interface with easy access to all features
- Framework: Gin Web Framework for high-performance HTTP routing
- WebSocket: Gorilla WebSocket for real-time communication
- Configuration: Viper for flexible configuration management
- Logging: Logrus for structured logging
- System Monitoring: gopsutil for system metrics
- CORS: Built-in CORS middleware for cross-origin requests
- Framework: Vue 3 with Composition API
- UI Library: Vuetify 3 for Material Design components
- State Management: Pinia for reactive state management
- Routing: Vue Router for SPA navigation
- Code Editor: Monaco Editor (VS Code's editor) with Nginx syntax support
- HTTP Client: Axios for API communication
- Build Tool: Vite for fast development and optimized builds
nginx_manager/
βββ main.go # Application entry point
βββ go.mod # Go module dependencies
βββ go.sum # Go module checksums
βββ configs/
β βββ config.yaml # Application configuration
β βββ nginx_template.conf # Nginx configuration template
βββ internal/ # Internal Go packages
β βββ config/ # Configuration management
β β βββ config.go
β βββ handler/ # HTTP request handlers
β β βββ nginx.go # Nginx service operations
β β βββ config.go # Configuration file management
β β βββ websocket.go # WebSocket connections
β βββ middleware/ # HTTP middleware
β β βββ cors.go # CORS handling
β βββ nginx/ # Nginx-specific utilities
β βββ config.go # Nginx configuration operations
β βββ service.go # Nginx service management
βββ frontend/ # Vue.js frontend application
β βββ src/
β β βββ api/ # API client functions
β β β βββ nginx.js
β β βββ stores/ # Pinia state stores
β β β βββ nginx.js
β β βββ views/ # Page components
β β β βββ Dashboard.vue # Main dashboard
β β β βββ ConfigEditor.vue # Configuration editor
β β β βββ BackupManager.vue # Backup management
β β β βββ LogViewer.vue # Log viewing
β β βββ router/ # Vue Router configuration
β β β βββ index.js
β β βββ plugins/ # Vue plugins
β β β βββ vuetify.js
β β βββ css/ # Custom stylesheets
β β β βββ css2.css
β β βββ App.vue # Root component
β β βββ main.js # Application entry point
β βββ index.html # HTML template
β βββ package.json # Node.js dependencies
β βββ vite.config.js # Vite configuration
βββ backups/ # Automatic backup storage
βββ logs/ # Application logs
βββ static/ # Built frontend assets (production)
βββ web/ # Alternative static assets
βββ README.md # This file
- Go: 1.23.0 or higher
- Node.js: 18.0 or higher
- Nginx: Installed on Windows system
- Git: For cloning the repository
git clone <repository-url>
cd nginx_manager
Edit configs/config.yaml
to match your Nginx installation:
server:
host: "127.0.0.1"
port: 8080
debug: true
nginx:
executable_path: "C:/nginx/nginx.exe" # Your nginx.exe path
config_path: "C:/nginx/conf/nginx.conf" # Your nginx.conf path
log_path: "C:/nginx/logs" # Your logs directory
pid_file: "C:/nginx/logs/nginx.pid" # Your PID file path
security:
enable_auth: false # Set to true for authentication
username: "admin" # Authentication username
password: "password" # Authentication password
backup:
enable: true
backup_dir: "./backups"
max_backups: 10
# Install Go dependencies
go mod tidy
# Run the server
go run main.go
The server will start at http://localhost:8080
For development with hot reload:
cd frontend
npm install
npm run dev
Frontend dev server will start at http://localhost:5173
# Build frontend
cd frontend
npm install
npm run build
# Build backend (includes frontend assets)
cd ..
go build -o nginx-manager.exe main.go
# Run production binary
./nginx-manager.exe
Method | Endpoint | Description |
---|---|---|
GET |
/api/nginx/status |
Get current Nginx service status |
POST |
/api/nginx/start |
Start Nginx service |
POST |
/api/nginx/stop |
Stop Nginx service |
POST |
/api/nginx/restart |
Restart Nginx service |
POST |
/api/nginx/reload |
Reload Nginx configuration |
Method | Endpoint | Description |
---|---|---|
GET |
/api/config |
Get current configuration content |
PUT |
/api/config |
Save configuration file |
POST |
/api/config/validate |
Validate configuration syntax |
GET |
/api/config/template |
Get configuration template |
Method | Endpoint | Description |
---|---|---|
GET |
/api/backup |
Get list of available backups |
GET |
/api/backup/download/:id |
Download specific backup file |
POST |
/api/backup/restore/:id |
Restore configuration from backup |
DELETE |
/api/backup/:id |
Delete specific backup |
Endpoint | Description |
---|---|
WS /ws/status |
Real-time status updates with auto-reconnection |
- Real-time Status: Live display of Nginx service status
- Process Information: PID, version, and uptime details
- Quick Actions: One-click service control buttons
- System Metrics: CPU, memory, and disk usage
- Connection Status: WebSocket connection indicator
- Advanced Editor: Monaco Editor with Nginx syntax highlighting
- Real-time Validation: Instant syntax checking
- Auto-completion: Intelligent code suggestions
- Auto-backup: Automatic backup before saving changes
- Template Support: Pre-built configuration templates
- Automatic Backups: Timestamped backups on configuration changes
- Version Control: Browse and compare backup versions
- One-click Restore: Instant rollback to any previous version
- Download Support: Export backup files
- Cleanup: Automatic removal of old backups
- Real-time Logs: Live access and error log viewing
- Filtering: Search and filter log entries
- Auto-refresh: Automatic log updates
- Export: Download log files
host
: Server binding address (default: "127.0.0.1")port
: Server port (default: 8080)debug
: Enable debug mode (default: true)
executable_path
: Path to nginx.execonfig_path
: Path to nginx.conflog_path
: Directory containing Nginx logspid_file
: Path to Nginx PID file
enable_auth
: Enable basic authenticationusername
: Authentication usernamepassword
: Authentication password
enable
: Enable automatic backupsbackup_dir
: Backup storage directorymax_backups
: Maximum number of backups to keep
- Basic Authentication: Optional username/password protection
- CORS Protection: Configurable cross-origin request handling
- Input Validation: Comprehensive validation of all inputs
- Error Handling: Secure error responses without sensitive information
- File Permissions: Proper file access controls
- Service Status: Continuous monitoring of Nginx process
- System Metrics: CPU, memory, and disk usage tracking
- WebSocket Updates: Real-time status broadcasting
- Connection Health: Automatic reconnection on failures
- Structured Logging: JSON-formatted logs with Logrus
- Multiple Levels: Debug, Info, Warning, Error levels
- File Rotation: Automatic log file management
- Performance Tracking: Request timing and performance metrics
-
Permission Denied
- Ensure the application has permissions to access Nginx files
- Run as administrator if required
-
Nginx Not Found
- Verify the
executable_path
in config.yaml - Ensure Nginx is properly installed
- Verify the
-
Port Already in Use
- Change the port in config.yaml
- Check for other services using port 8080
-
WebSocket Connection Failed
- Check firewall settings
- Verify CORS configuration
Enable debug mode in config.yaml
:
server:
debug: true
This will provide detailed logging and error information.
github.com/gin-gonic/gin
- Web frameworkgithub.com/gorilla/websocket
- WebSocket supportgithub.com/spf13/viper
- Configuration managementgithub.com/sirupsen/logrus
- Structured logginggithub.com/gin-contrib/cors
- CORS middlewaregithub.com/shirou/gopsutil/v3
- System monitoring
vue@^3.4.0
- Vue.js frameworkvuetify@^3.4.0
- Material Design UIpinia@^2.1.7
- State managementvue-router@^4.2.5
- Routingaxios@^1.6.2
- HTTP clientmonaco-editor@^0.44.0
- Code editor
We welcome contributions! Please feel free to submit issues and pull requests.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
- Follow Go formatting standards (
gofmt
) - Use meaningful commit messages
- Add comments for complex logic
- Follow Vue.js style guide for frontend code
This project is licensed under the MIT License - see the LICENSE file for details.
- Gin - Fast HTTP web framework
- Vuetify - Material Design component framework
- Monaco Editor - Code editor
- Vue.js - Progressive JavaScript framework
Nginx Manager - Simplifying Nginx management on Windows systems.