nginx-domain-manager
v1.0.1
Published
A one-command CLI tool to manage Nginx reverse proxy domains, SSL certificates, and application ports on Linux servers
Downloads
304
Maintainers
Readme
nginx-domain-manager
A one-command CLI tool (ndm) to manage Nginx reverse proxy domains, SSL certificates, and application ports on Linux servers.
Features
- Interactive domain setup with prompts
- Automatic SSL via Certbot (Let's Encrypt)
- Firewall configuration (ufw / firewalld)
- Safe operations — always runs
nginx -tbefore reloading, rolls back on failure - Persistent metadata stored in
/var/lib/ndm/domains.json - System health check with auto-repair (
ndm doctor --fix) - One-command VPS bootstrap (
ndm bootstrap)
Supported Operating Systems
| OS | Package Manager | |----|----------------| | Ubuntu | apt | | Debian | apt | | Fedora | dnf | | CentOS / RHEL | yum |
Installation
npm install -g nginx-domain-managerAll privileged commands must be run with
sudo.
Commands
ndm create
Interactively set up a new reverse proxy domain.
sudo ndm createPrompts for: domain, www subdomain, app port, SSL, email.
ndm remove <domain>
Remove a domain configuration.
sudo ndm remove example.comOptionally revokes the SSL certificate.
ndm update-port <domain> <port>
Update the application port for a domain.
sudo ndm update-port example.com 5400ndm status <domain>
Show detailed status for a domain.
ndm status example.comOutput includes: port, SSL status, nginx service status, certificate expiry.
ndm list
List all managed domains in a table.
ndm listDOMAIN PORT SSL CREATED
─────────────────────────────────────────────────────────
example.com 3000 Yes 2026-05-31
api.example.com 8080 No 2026-05-31ndm doctor
Check system health — nginx, certbot, firewall, ports.
ndm doctor
sudo ndm doctor --fix # auto-repair issuesndm bootstrap
Prepare a fresh VPS by installing all dependencies.
sudo ndm bootstrapInstalls: nginx, certbot, python3-certbot-nginx, curl, git. Enables nginx and configures the firewall.
ndm ssl-renew
Renew all SSL certificates.
sudo ndm ssl-renew
sudo ndm ssl-renew --dry-run # test without changesExamples
Full domain setup
sudo ndm bootstrap # first time VPS setup
sudo ndm create # follow the prompts
ndm list # verify
ndm status example.com # check statusMigrate app to a new port
sudo ndm update-port example.com 4000Clean up a domain
sudo ndm remove example.comMetadata Storage
All domain configs are stored at /var/lib/ndm/domains.json:
{
"example.com": {
"port": 3000,
"ssl": true,
"email": "[email protected]",
"includeWww": true,
"createdAt": "2026-05-31"
}
}Environment Variables
| Variable | Effect |
|----------|--------|
| NDM_DEBUG=1 | Enable verbose debug logging |
Troubleshooting
"Please run this command with sudo."
All write operations require root. Prefix the command with sudo.
Nginx config test fails after SSL
Run sudo nginx -t to see the error. If certbot modified the config incorrectly, check /etc/nginx/sites-available/<domain>.
certbot not found
Run sudo ndm bootstrap or sudo ndm doctor --fix.
Port already in use
Check what's running: ss -tlnp | grep :PORT. Update with ndm update-port.
Architecture
src/
├── commands/ # Commander.js command handlers (one file per command)
├── services/ # Core business logic (nginx, certbot, firewall, storage, system)
├── utils/ # Shared helpers (logger, validator, permissions)
└── index.ts # CLI entry pointDevelopment
git clone https://github.com/your-org/nginx-domain-manager.git
cd nginx-domain-manager
npm install
npm run build
npm testRoadmap
- [ ] Multi-server management via SSH
- [ ]
ndm backup— export all configs - [ ]
ndm restore— import configs from backup - [ ] Web dashboard (optional)
- [ ]
ndm logs <domain>— tail nginx access/error logs - [ ] Slack/webhook notifications for certificate expiry
Contributing
See CONTRIBUTING.md.
