Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Webadmin Project

A web-based administration suite for Apache2 and Nginx on Ubuntu systems. This repository contains two independent admin panels: Apache-Webadmin and Nginx-Webadmin, each built as a single static Go binary with an embedded React SPA.

Project Overview

  • Apache-Webadmin: Manage Apache virtual hosts, modules, SSL certificates, PHP-FPM pools, firewall rules, health checks, and audit logging.
  • Nginx-Webadmin: Manage Nginx virtual hosts, redirects, rewrites, SSL certificates, PHP-FPM pools, firewall rules, reverse proxy upstreams, and audit logging.

Both projects are designed for Ubuntu servers with minimal runtime dependencies and a secure, non-root service model.

Key Features

Common Features (Both Apache and Nginx)

  • Modern web UI: React SPA with responsive layout
  • Admin login: secure credentials with session handling
  • Audit trail: track configuration changes and actions
  • Let's Encrypt support: integrated Certbot workflows
  • Firewall management: UFW rule creation with lockout protection
  • Live monitoring: metrics and log tailing
  • Health checks: system and configuration validation
  • Secure service model: non-root daemon with scoped sudo permissions

Apache-Webadmin Specific Features

  • Virtual host management: create, enable, disable Apache sites
  • Apache module toggling: uses a2enmod / a2dismod
  • PHP-FPM support: manage PHP pools and versions
  • Config validation: runs apache2ctl configtest before applying changes

Nginx-Webadmin Specific Features

  • Virtual host management: create, enable, disable Nginx sites
  • Redirects & rewrites: build advanced URL rules
  • Access control: per-path IP and method restrictions
  • Reverse proxy upstreams: load-balanced backend pools
  • File-type blocking: security-focused request filtering
  • phpMyAdmin support: configurable phpmyadmin integration
  • Dedicated PHP pools: per-site PHP-FPM pool support

Architecture

Backend (Go)

  • Go version: 1.22
  • HTTP router: chi
  • Storage: SQLite for users, sessions, and audit logs
  • Security: CSRF, secure cookies, rate limiting
  • Config: YAML-based configuration files
  • Assets: frontend files embedded via Go embed

Frontend (React/TypeScript)

  • React 19
  • TypeScript
  • Vite for development and production builds
  • Tailwind CSS for styling
  • TanStack Query for server state
  • React Hook Form with Zod validation
  • Drag-and-drop support via @dnd-kit

Packaging

  • Debian packages for Ubuntu
  • Minimal runtime dependencies: web server, certbot, UFW, PHP-FPM where applicable
  • Systemd service with restricted sudoers access

Build Requirements

  • Go 1.22 or later
  • Node.js 18+ and npm
  • Debian packaging tools (debhelper, dpkg-dev, etc.)
  • Ubuntu build environment

Building from Source

Apache-Webadmin

cd Apache-Webadmin

# Frontend
cd web
npm ci
npm run build
cd ..

# Backend
GOTOOLCHAIN=local CGO_ENABLED=0 go build \
  -tags=osusergo,netgo -ldflags "-s -w" \
  -o apache-webadmin ./cmd/apache-webadmin/

# Or use make
make build
make deb   # creates ../apache-webadmin_0.1.0_amd64.deb

Nginx-Webadmin

cd Nginx-Webadmin

# Frontend
cd web
npm ci
npm run build
cd ..

# Backend
GOTOOLCHAIN=local CGO_ENABLED=0 go build \
  -tags=osusergo,netgo -ldflags "-s -w" \
  -o nginx-webadmin ./cmd/nginx-webadmin/

# Or use make
make build
make deb   # creates ../nginx-webadmin_0.1.0_amd64.deb

Installation

From Debian packages (recommended)

sudo apt install ./apache-webadmin_0.1.0_amd64.deb
sudo apache-webadmin createadmin --username admin --password secret123
sudo systemctl enable --now apache-webadmin

sudo apt install ./nginx-webadmin_0.1.0_amd64.deb
sudo nginx-webadmin createadmin --username admin --password secret123
sudo systemctl enable --now nginx-webadmin

Manual installation

sudo mkdir -p /etc/apache-webadmin /var/lib/apache-webadmin
sudo mkdir -p /etc/nginx-webadmin /var/lib/nginx-webadmin

sudo cp apache-webadmin /usr/bin/
sudo cp nginx-webadmin /usr/bin/

sudo useradd --system --shell /bin/false apache-webadmin
sudo useradd --system --shell /bin/false nginx-webadmin

sudo chown apache-webadmin:apache-webadmin /var/lib/apache-webadmin
sudo chown nginx-webadmin:nginx-webadmin /var/lib/nginx-webadmin

Configuration

Apache-Webadmin (/etc/apache-webadmin/config.yaml)

listen: "127.0.0.1:9100"
data_dir: "/var/lib/apache-webadmin"

# Optional TLS for the admin interface
# tls_cert: "/etc/letsencrypt/live/yourdomain.com/fullchain.pem"
# tls_key: "/etc/letsencrypt/live/yourdomain.com/privkey.pem"

apache2_sites_available: "/etc/apache2/sites-available"
apache2_sites_enabled: "/etc/apache2/sites-enabled"
apache2_conf_available: "/etc/apache2/conf-available"
apache2_conf_enabled: "/etc/apache2/conf-enabled"
apache2_log_dir: "/var/log/apache2"
php_dir: "/etc/php"

Nginx-Webadmin (/etc/nginx-webadmin/config.yaml)

listen: "127.0.0.1:9000"
data_dir: "/var/lib/nginx-webadmin"

# Optional TLS for the admin interface
# tls_cert: "/etc/letsencrypt/live/yourdomain.com/fullchain.pem"
# tls_key: "/etc/letsencrypt/live/yourdomain.com/privkey.pem"

nginx_sites_available: "/etc/nginx/sites-available"
nginx_sites_enabled: "/etc/nginx/sites-enabled"
nginx_conf_d: "/etc/nginx/conf.d"
nginx_snippets: "/etc/nginx/snippets"
nginx_log_dir: "/var/log/nginx"
php_dir: "/etc/php"
pma_path: "/usr/share/phpmyadmin"

Usage

Accessing the UI

Remote access via SSH tunnel:

ssh -L 9100:127.0.0.1:9100 yourserver   # Apache
ssh -L 9000:127.0.0.1:9000 yourserver   # Nginx

Common workflows

  1. Login with admin credentials
  2. Review dashboard metrics and recent activity
  3. Create and manage virtual hosts
  4. Issue and manage SSL certificates
  5. Configure firewall rules safely
  6. Tail live access and error logs
  7. Audit configuration changes

CLI commands

apache-webadmin version
nginx-webadmin version

sudo apache-webadmin createadmin --username admin --password newpassword
sudo nginx-webadmin createadmin --username admin --password newpassword

sudo apache-webadmin doctor
sudo nginx-webadmin doctor

Security Considerations

  • Services run as non-root users (apache-webadmin / nginx-webadmin)
  • Restricted sudo privileges are granted only for required commands
  • Configuration changes are validated before being applied
  • Failed config changes do not break the live server
  • Admin-only UI access is bound to localhost by default
  • CSRF protection and secure session handling are enabled
  • Only assets and files created by Webadmin are managed automatically

Development

Development Setup

# Clone and setup
cd Apache-Webadmin  # or Nginx-Webadmin

# Backend development
go run ./cmd/apache-webadmin/ --config /tmp/config.yaml

# Frontend development (with hot reload)
cd web
npm run dev  # Proxies API calls to backend

# Design system gallery (dev only)
# Visit http://127.0.0.1:5173/design

Project Structure

Apache-Webadmin/
├── cmd/apache-webadmin/     # Main application entry point
├── internal/
│   ├── api/                 # HTTP handlers and routing
│   ├── apachecfg/           # Apache configuration generation
│   ├── apachectl/           # Apache control commands
│   ├── apachelog/           # Log parsing and tailing
│   ├── auth/                # Authentication middleware
│   ├── certbot/             # SSL certificate management
│   ├── config/              # Configuration loading
│   ├── dbms/                # Database management
│   ├── doctor/              # Health check system
│   ├── firewall/            # UFW rule management
│   ├── modules/             # Apache module management
│   ├── phpfpm/              # PHP-FPM pool management
│   ├── ssl/                 # SSL configuration
│   ├── store/               # Database operations
│   └── web/                 # Embedded web assets
├── web/                     # React frontend source
├── debian/                  # Debian packaging files
└── Makefile                 # Build automation

Dependencies

Go Dependencies (both projects):

  • github.com/go-chi/chi/v5: HTTP router
  • github.com/gorilla/csrf: CSRF protection
  • golang.org/x/crypto: Cryptographic functions
  • modernc.org/sqlite: SQLite database driver
  • gopkg.in/yaml.v3: YAML configuration parsing

Node.js Dependencies (frontend):

  • React 19 with TypeScript
  • Tailwind CSS for styling
  • TanStack Query for data fetching
  • React Hook Form + Zod for form validation
  • Motion for animations

Troubleshooting

Common Issues

Service won't start:

sudo journalctl -u apache-webadmin -f
sudo journalctl -u nginx-webadmin -f

Configuration validation fails:

sudo apache2ctl configtest
sudo nginx -t

Permission issues:

  • Check sudoers file: /etc/sudoers.d/apache-webadmin
  • Verify service user exists and has correct permissions

Database issues:

  • SQLite database location: /var/lib/apache-webadmin/admin.db
  • Inspect with: sudo sqlite3 /var/lib/apache-webadmin/admin.db

Reset Procedures

Reset admin password:

sudo apache-webadmin createadmin --username admin --password newpassword
sudo nginx-webadmin createadmin --username admin --password newpassword

Reinstall package:

sudo dpkg --purge apache-webadmin
sudo apt install ./apache-webadmin_0.1.0_amd64.deb

Download and Installation

Download Latest Release

The Webadmin project provides pre-built Debian packages for easy installation. Download the latest versions from the project's release page or use the following commands:

# Set the desired version (update this for new releases)
APACHE_VERSION="0.1.0"
NGINX_VERSION="0.1.0"

# Download Apache-Webadmin package
wget https://github.com/Modracx/Webadmin/releases/download/v${APACHE_VERSION}/apache-webadmin_${APACHE_VERSION}_amd64.deb

# Download Nginx-Webadmin package
wget https://github.com/Modracx/Webadmin/releases/download/v${NGINX_VERSION}/nginx-webadmin_${NGINX_VERSION}_amd64.deb

Install from Downloaded Packages

# Install Apache-Webadmin
sudo apt update
sudo apt install ./apache-webadmin_${APACHE_VERSION}_amd64.deb

# Install Nginx-Webadmin
sudo apt install ./nginx-webadmin_${NGINX_VERSION}_amd64.deb

Post-Installation Setup

After installation, create the admin user and start the services:

# Create admin user for Apache-Webadmin
sudo apache-webadmin createadmin --username admin --password your_secure_password

# Create admin user for Nginx-Webadmin
sudo nginx-webadmin createadmin --username admin --password your_secure_password

# Enable and start services
sudo systemctl enable apache-webadmin nginx-webadmin
sudo systemctl start apache-webadmin nginx-webadmin

# Verify services are running
sudo systemctl status apache-webadmin
sudo systemctl status nginx-webadmin

Access the Web Interfaces

For remote access, use SSH port forwarding:

# Apache-Webadmin
ssh -L 9100:127.0.0.1:9100 your-server

# Nginx-Webadmin
ssh -L 9000:127.0.0.1:9000 your-server

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make changes with tests
  4. Submit a pull request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Version

Current version: 0.1.0

Support

For issues and questions:

  • Check the troubleshooting section above
  • Review service logs with journalctl
  • Run the doctor command for health checks
  • Examine audit logs for change history /var/www/project/Webadmin/README.md

About

Open-source web admin panels for Apache & Nginx with easy-to-install Debian packages. Manage your servers with simplicity, speed, and flexibility.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages