Comprehensive Nginx management system with ModSecurity WAF, Domain Management, SSL Certificates and Real-time Monitoring.
Recommendations: The software is developed with the support of AI so it cannot be absolutely secure, so please protect the Portal and API with a firewall to ensure safety. If you find any problems, please notify us and we will handle it..
- π ModSecurity WAF - OWASP Core Rule Set (CRS) + Custom Rules
- π Domain Management - Load balancing, upstream monitoring, HTTPS backend support
- π SSL Certificate Management - Auto Let's Encrypt + Manual upload
- π₯ Multi-user Management - Role-based access control (Admin/Moderator/Viewer)
- π Real-time Monitoring - Performance metrics, alerts, system health
- π‘οΈ Access Control Lists (ACL) - IP whitelist/blacklist, GeoIP, User-Agent filtering
- π Activity Logging - Comprehensive audit trail
- π Smart Alerts - Email/Telegram notifications with custom conditions
- πΎ Database Management - PostgreSQL with Prisma ORM
- π¨ Modern UI - React + TypeScript + ShadCN UI + Tailwind CSS
| Use Case | Script | Description |
|---|---|---|
| New Server (Production) | ./scripts/deploy.sh |
Full installation of Nginx + ModSecurity + Backend + Frontend with systemd services |
| Development/Testing | ./scripts/quickstart.sh |
Quick run in dev mode (no Nginx installation, no root required) |
# Clone repository
git clone https://github.com/TinyActive/nginx-love.git
cd nginx-love
# Run deployment script (requires root)
bash scripts/deploy.shMinimum Requirements:
- Ubuntu/Debian server (22.04+ recommended)
- Root access
- RAM: 2GB+ (4GB+ recommended)
- Storage: 10GB+ free space
- Internet connection
The script will automatically install everything:
- β Node.js 20.x (if not present)
- β pnpm 8.15.0 (if not present)
- β Docker + Docker Compose (if not present)
- β PostgreSQL 15 container (auto-generated credentials)
- β Nginx + ModSecurity + OWASP CRS
- β Backend API + Frontend (production build)
- β Systemd services with auto-start
- β CORS configuration with Public IP
Credentials saved at: /root/.nginx-love-credentials
# Clone repository
git clone https://github.com/TinyActive/nginx-love.git
cd nginx-love
# Run quick start (no root required)
./scripts/quickstart.shThis will:
- Install dependencies
- Start PostgreSQL in Docker (optional)
- Run database migrations and seeding
- Start backend on http://localhost:3001
- Start frontend on http://localhost:8080 (dev mode)
Press Ctrl+C to stop all services
Username: admin
Password: admin123
- Frontend: http://localhost:8080
- Backend API: http://localhost:3001
- API Documentation: http://localhost:3001/api-docs
- Prisma Studio: http://localhost:5555 (dev only)
- Health Check: http://localhost:3001/api/health
- Frontend: http://YOUR_IP:8080
- Backend API: http://YOUR_IP:3001
- API Documentation: http://YOUR_IP:3001/api-docs
- Health Check: http://YOUR_IP:3001/api/health
- API Documentation - Complete REST API reference
- OpenAPI Specification - Swagger/OpenAPI 3.0 spec
- Database Schema - Prisma schema with relationships
- Installation Scripts - Automated installation scripts
POST /api/auth/login- User login with 2FA supportPOST /api/auth/logout- User logoutPOST /api/auth/refresh- Refresh access tokenGET /api/account/profile- Get user profilePUT /api/account/profile- Update user profilePOST /api/account/change-password- Change password
GET /api/domains- List all domainsPOST /api/domains- Create new domainPUT /api/domains/:id- Update domain configurationDELETE /api/domains/:id- Delete domainGET /api/domains/:id/upstreams- Get domain upstreamsPOST /api/domains/:id/upstreams- Add upstream server
GET /api/ssl/certificates- List SSL certificatesPOST /api/ssl/generate- Generate Let's Encrypt certificatePOST /api/ssl/upload- Upload custom certificateDELETE /api/ssl/:id- Delete certificatePOST /api/ssl/renew- Renew certificate
GET /api/modsec/crs-rules- List OWASP CRS rulesPUT /api/modsec/crs-rules/:id- Toggle CRS ruleGET /api/modsec/custom-rules- List custom rulesPOST /api/modsec/custom-rules- Create custom rulePUT /api/modsec/custom-rules/:id- Update custom rule
GET /api/acl/rules- List ACL rulesPOST /api/acl/rules- Create ACL rulePUT /api/acl/rules/:id- Update ACL ruleDELETE /api/acl/rules/:id- Delete ACL rule
GET /api/performance/metrics- Get performance metricsGET /api/alerts/rules- List alert rulesPOST /api/alerts/rules- Create alert ruleGET /api/alerts/history- Alert historyPOST /api/alerts/acknowledge- Acknowledge alert
GET /api/system/status- System health statusPOST /api/system/nginx/reload- Reload Nginx configurationGET /api/logs- System logs with filteringGET /api/users- User management (admin only)
- Framework: React 18 + Vite + TypeScript
- UI Library: ShadCN UI + Radix UI Primitives
- Styling: Tailwind CSS + CSS Variables
- State Management: Zustand + TanStack Query
- Icons: Lucide React
- Forms: React Hook Form + Zod validation
- Internationalization: i18next
- Runtime: Node.js 20+
- Framework: Express.js + TypeScript
- Database ORM: Prisma
- Authentication: JWT + Refresh Tokens + 2FA (TOTP)
- Validation: Express Validator
- Security: Helmet + CORS + bcrypt
- Logging: Winston + Morgan
- Email: Nodemailer
- API Documentation: OpenAPI/Swagger
- Database: PostgreSQL 15 (Docker)
- Web Server: Nginx + ModSecurity 3.x
- SSL: Let's Encrypt (acme.sh) + Manual certificates
- WAF: OWASP ModSecurity Core Rule Set (CRS)
- Containerization: Docker + Docker Compose
- Process Management: systemd (production)
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β β β β β
β Frontend ββββββ€ Nginx Proxy ββββββ€ Users/API β
β (React SPA) β β + ModSecurity β β Clients β
β Port: 8080 β β + SSL β β β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β
βΌ βΌ
βββββββββββββββββββ ββββββββββββββββββββ
β β β β
β Backend API β β Upstream β
β (Express.js) β β Applications β
β Port: 3001 β β (HTTP/HTTPS) β
βββββββββββββββββββ ββββββββββββββββββββ
β
βΌ
βββββββββββββββββββ
β β
β PostgreSQL β
β Database β
β Port: 5432 β
βββββββββββββββββββ
- Users: Multi-role user management (admin/moderator/viewer)
- Domains: Domain configuration with upstream management
- Upstreams: Backend server configuration with health checks
- SSL Certificates: Certificate management with auto-renewal
- ModSecurity Rules: CRS rules + custom rules per domain
- ACL Rules: Access control with multiple conditions
- Performance Metrics: Real-time performance tracking
- Alert System: Configurable alerts with multi-channel notifications
- Activity Logs: Comprehensive audit trail
# PostgreSQL Database
docker start nginx-love-postgres
docker stop nginx-love-postgres
docker restart nginx-love-postgres
docker logs -f nginx-love-postgres
# Backend API Service
sudo systemctl start nginx-love-backend
sudo systemctl stop nginx-love-backend
sudo systemctl restart nginx-love-backend
sudo systemctl status nginx-love-backend
# Frontend Service
sudo systemctl start nginx-love-frontend
sudo systemctl stop nginx-love-frontend
sudo systemctl restart nginx-love-frontend
sudo systemctl status nginx-love-frontend
# Nginx Web Server
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
sudo systemctl status nginx
sudo nginx -t # Test configuration
sudo nginx -s reload # Reload configuration# Start development servers
cd nginx-love
# Backend (Terminal 1)
cd apps/api && pnpm dev
# Frontend (Terminal 2)
cd apps/web && pnpm dev
# Database operations
cd apps/api
pnpm prisma:studio # Open Prisma Studio
pnpm prisma:migrate # Run migrations
pnpm prisma:seed # Seed database
# Stop services
Ctrl+C # In each terminal
# Or force kill processes
npx kill-port 3001 # Backend port
npx kill-port 8080 # Frontend port (dev & prod)
npx kill-port 5555 # Prisma Studio port# Application logs
sudo journalctl -u nginx-love-backend -f # Backend logs
sudo journalctl -u nginx-love-frontend -f # Frontend logs
tail -f /var/log/nginx-love-backend.log # Backend log file
tail -f /var/log/nginx-love-frontend.log # Frontend log file
# System logs
docker logs -f nginx-love-postgres # Database logs
tail -f /var/log/nginx/access.log # Nginx access logs
tail -f /var/log/nginx/error.log # Nginx error logs
tail -f /var/log/modsec_audit.log # ModSecurity audit logs
# Log rotation and management
sudo logrotate -f /etc/logrotate.d/nginx-love
ls -la /var/log/nginx-love-*.log*# Real-time logs
tail -f /tmp/backend.log # Backend development logs
tail -f /tmp/frontend.log # Frontend development logs
# Application-specific logs
cd apps/api && pnpm dev # Shows real-time backend logs
cd apps/web && pnpm dev # Shows real-time frontend logs + HMR
# Database logs
docker logs -f nginx-love-postgres
# Combined log viewing
multitail /tmp/backend.log /tmp/frontend.log# Check what's using ports
sudo netstat -tulnp | grep :3001 # Backend port
sudo netstat -tulnp | grep :8080 # Frontend port (dev & prod)
sudo netstat -tulnp | grep :5432 # PostgreSQL port
# Kill processes on specific ports
sudo lsof -ti:3001 | xargs kill -9 # Backend
sudo lsof -ti:8080 | xargs kill -9 # Frontend (dev & prod)
sudo lsof -ti:5555 | xargs kill -9 # Prisma Studio
# Alternative method
sudo fuser -k 3001/tcp
sudo fuser -k 8080/tcp# Check PostgreSQL container
docker ps | grep postgres
docker container inspect nginx-love-postgres
# Check database connectivity
cd apps/api
pnpm prisma db push --force-reset # Reset database
pnpm prisma generate # Regenerate client
pnpm prisma migrate reset # Reset migrations
# Check environment variables
cat apps/api/.env | grep DATABASE_URL
cd apps/api && node -e "console.log(process.env.DATABASE_URL)"
# Direct database connection test
docker exec -it nginx-love-postgres psql -U nginx_love_user -d nginx_love_db# Test nginx configuration
sudo nginx -t
sudo nginx -T # Show complete configuration
# Check ModSecurity status
sudo tail -f /var/log/nginx/error.log | grep -i modsec
# Verify SSL certificates
sudo openssl x509 -in /etc/nginx/ssl/domain.crt -text -noout
# Check upstream connectivity
curl -I http://localhost:3001/api/health# Check system resources
htop
df -h
free -h
# Check application memory usage
ps aux | grep node | grep -v grep
docker stats nginx-love-postgres
# Database performance
docker exec -it nginx-love-postgres psql -U nginx_love_user -d nginx_love_db -c "
SELECT schemaname,tablename,attname,n_distinct,correlation
FROM pg_stats WHERE tablename IN ('domains','users','performance_metrics');
"Error: "EADDRINUSE: address already in use"
# Find and kill the process
sudo lsof -i :3001
sudo kill -9 <PID>Error: "Database connection failed"
# Restart PostgreSQL container
docker restart nginx-love-postgres
# Wait 10 seconds for startup
sleep 10
cd apps/api && pnpm devError: "ModSecurity failed to load"
# Check ModSecurity installation
nginx -V 2>&1 | grep -o with-compat
ls -la /etc/nginx/modules/
sudo nginx -tError: "SSL certificate not found"
# Check certificate files
sudo ls -la /etc/nginx/ssl/
# Regenerate certificates
sudo /root/.acme.sh/acme.sh --renew -d yourdomain.com --force# 1. Fork and clone repository
git clone https://github.com/TinyActive/nginx-love.git
cd nginx-love
# 2. Install dependencies
pnpm install
# 3. Setup database
docker-compose -f docker-compose.db.yml up -d
cd apps/api
cp .env.example .env # Configure environment variables
pnpm prisma:migrate # Run database migrations
pnpm prisma:seed # Seed initial data
# 4. Start development servers
cd apps/web && pnpm dev # Frontend (Terminal 1)
cd apps/api && pnpm dev # Backend (Terminal 2)# Linting and formatting
pnpm lint # ESLint check
pnpm lint:fix # Auto-fix ESLint issues
# Type checking
cd apps/api && npx tsc --noEmit # TypeScript check
npx tsc --noEmit # Frontend TypeScript check
# Database operations
cd apps/api
pnpm prisma:studio # Database GUI
pnpm prisma:generate # Regenerate Prisma client
pnpm prisma:migrate # Create new migration# Unit tests (future implementation)
pnpm test # Frontend tests
cd apps/api && pnpm test # Backend tests
# API testing
curl -X GET http://localhost:3001/api/health
curl -X POST http://localhost:3001/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin123"}'-
Fork the repository
git clone https://github.com/YourUsername/nginx-love.git
-
Create feature branch
git checkout -b feature/amazing-feature
-
Make changes following conventions
- Use TypeScript for type safety
- Follow existing code style
- Add JSDoc comments for functions
- Update database schema via Prisma migrations
- Test API endpoints manually
-
Commit changes
git add . git commit -m "feat: add amazing feature"
-
Push and create PR
git push origin feature/amazing-feature
feat:New featuresfix:Bug fixesdocs:Documentation changesstyle:Code style changesrefactor:Code refactoringtest:Test additions/modificationschore:Build/config changes
This project is licensed under the MIT License - see the LICENSE file for details.
- π Bug Reports: GitHub Issues
- π‘ Feature Requests: GitHub Discussions
- π Documentation: Project Wiki
- π¬ Community: Discord Server (coming soon)
For security vulnerabilities, please email: security@tinyactive.net
π₯ Made with β€οΈ by TinyActive Team
β Star this repository if it helped you!