The `Nginx Proxy Manager Backup` package provides an easy way to backup and restore configurations from Nginx Proxy Manager. It offers both programmatic access via a TypeScript API and a command-line interface (CLI) for ease of use.
The Nginx Proxy Manager Backup
package provides an easy way to backup and restore configurations from Nginx Proxy Manager. It offers both programmatic access via a TypeScript API and a command-line interface (CLI) for ease of use.
To use the Nginx Proxy Manager Backup
package, you need to install it from npm:
npm install nginx-backup
To use the package in your TypeScript project, follow these steps:
Import and Set Up:
import { NginxManager } from 'nginx-backup';
import { Backups } from 'nginx-backup';
const manager = new NginxManager('https://your-nginx-url', {
username: 'your-username',
password: 'your-password',
});
Login:
Ensure you log in to obtain an authentication token:
await manager.api.login();
Create a Backup:
await Backups.createBackup(manager, './backup-directory');
Restore a Backup:
await Backups.restoreBackup(manager, './backup-directory/backup.json');
To use the package via CLI, follow these steps:
Install Globally:
After publishing, install the package globally:
npm install -g nginx-backup
Create a Backup:
To create a backup, run:
nginx-backup create --url <NPM_URL> --username <USERNAME> --password <PASSWORD> --output-dir <OUTPUT_DIR>
Replace <NPM_URL>
, <USERNAME>
, <PASSWORD>
, and <OUTPUT_DIR>
with your Nginx Proxy Manager URL, credentials, and desired backup directory.
Restore a Backup:
To restore a backup, run:
nginx-backup restore --url <NPM_URL> --username <USERNAME> --password <PASSWORD> --file <BACKUP_FILE>
Replace <NPM_URL>
, <USERNAME>
, <PASSWORD>
, and <BACKUP_FILE>
with your Nginx Proxy Manager URL, credentials, and path to the backup file.
You can configure the CLI commands with the following options:
--url
- The URL of your Nginx Proxy Manager instance.--username
- Your Nginx Proxy Manager username.--password
- Your Nginx Proxy Manager password.--output-dir
- Directory where the backup will be saved (for backup creation).--file
- Path to the backup file to restore (for restore).Configure the NginxManager
with your instance URL and credentials:
const manager = new NginxManager('https://your-nginx-url', {
username: 'your-username',
password: 'your-password',
});
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
This project is licensed under the MIT License. See the LICENSE file for details.