Proxy-Manager-API is a simple API for managing Nginx Proxies Using https://nginxproxymanager.com.
npm install proxy-manager-api
yarn add proxy-manager-api
Login and Get all proxies. Then get the info of a certain domain proxied
const ProxyManager = require('proxy-manager-api');
const client = new ProxyManager.Client({
host: 'proxy.example.com',
email: '[email protected]',
password: 'admin'
});
client.connect().then(() => {
client.getProxies().then(proxies => {
console.log(proxies);
});
client.getProxy('proxied.example.com').then(proxy => {
console.log(proxy.ip);
});
});
If you want to proxy a new domain you can do it like this:
const ProxyManager = require('proxy-manager-api');
const client = new ProxyManager.Client({
host: 'proxy.example.com',
email: '[email protected]',
password: 'admin'
});
client.connect().then(() => {
client.proxy.createProxy({
domain: 'proxied.example.com',
ip: '0.0.0.0',
port: 8080,
ssl: true,
}).then(proxy => {
console.log(proxy);
})
});
If you want to proxy multiple domains to one ip and port you can do it like this:
const ProxyManager = require('proxy-manager-api');
const client = new ProxyManager.Client({
host: 'proxy.example.com',
email: '[email protected]',
password: 'admin'
});
client.connect().then(() => {
client.proxy.createProxy({
domain: ['proxied.example.com', 'proxied2.example.com'],
ip: '0.0.0.0',
port: 8080,
ssl: true,
}).then(proxy => {
console.log(proxy);
});
});
Docs Coming Soon.
This project is licensed under the MIT license. See the LICENSE file for details.