@cs7player/nginx_reverse_proxy
v1.0.2
Published
Nginx Reverse Proxy
Readme
Nginx Reverse Proxy CLI (nrp)
A simple Node.js CLI tool to manage Nginx reverse proxy configurations on Linux and Windows.
Supports adding, editing, listing, and deleting reverse proxy entries easily.
Features
- ✅ Detects Nginx installation on your system.
- ✅ Supports Ubuntu/Debian, Fedora, CentOS/RHEL, Arch Linux, openSUSE, and Windows (via Chocolatey).
- ✅ Add, edit, list, and delete
locationblocks in Nginx configuration. - ✅ Automatically handles permissions on Linux (
chmod 777) if required. - ✅ Displays proxy entries in a clean table format.
Installation
Globally via NPM:
npm install -g nginx_reverse_proxyUsage
After installation, you can use the nrp CLI.
nrp <command> [options]Commands
- list
List all current reverse proxy entries.
nrp list- add
Add a new reverse proxy entry. You will be prompted for:location(e.g.,/app)proxy_pass(e.g.,http://localhost:3000)
nrp add- edit [id]
Edit an existing proxy. You can pass the ID directly, or the CLI will prompt you.
nrp edit
nrp edit 2- delete [id]
Delete a proxy entry. You can pass the ID directly, or the CLI will prompt you.
nrp delete
nrp delete 2Supported Platforms
- Linux: Ubuntu, Debian, Fedora, CentOS/RHEL, Arch Linux, openSUSE
- Windows: Requires Chocolatey installed
The CLI automatically detects the OS and the correct Nginx config path.
Nginx Config Path
The CLI automatically selects the Nginx configuration file based on the platform:
| Platform | Config Path |
| --------------------------------- | ------------------------------------ |
| Ubuntu/Debian | /etc/nginx/sites-available/default |
| Fedora / CentOS / Arch / openSUSE | /etc/nginx/nginx.conf |
| Windows | C:\nginx\conf\nginx.conf |
Permissions
- On Linux, if the CLI cannot write to the Nginx config, it will attempt to run:
sudo chmod 777 <nginx_config_file>If this fails, you will need to manually change permissions.
On Windows, the CLI assumes user has permission to write to Nginx config directory.
Author
Chandra Sekhar
License
ISC
