Skip to content

Darker-Ink/Nginx-Proxy-Manger-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Proxy-Manager-API


GitHub issues GitHub forks GitHub stars

Info

Proxy-Manager-API is a simple API for managing Nginx Proxies Using https://nginxproxymanager.com.

Installation

npm install proxy-manager-api
yarn add proxy-manager-api

Usage

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: 'admin@example.com',
    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: 'admin@example.com',
    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: 'admin@example.com',
    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);
    });
});

Links

Docs Coming Soon.

License

This project is licensed under the MIT license. See the LICENSE file for details.