# nv-cli-nginx-conf

> nv-cli-nginx-conf =============== - nv-cli-nginx-conf - cli tool, nginx conf for a special format

Latest version **1.0.4** (published 2021-07-08) · ISC license · 0 weekly downloads

## Install

```sh
npm install nv-cli-nginx-conf
pnpm add nv-cli-nginx-conf
yarn add nv-cli-nginx-conf
bun add nv-cli-nginx-conf
```

Provides the commands `ngx_conf_app`, `ngx_conf_srv`, `ngx_conf_init`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2021-07-08 |
| First published | 2021-07-07 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 42.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | ihgazni2 |

## Links

- npm: https://www.npmjs.com/package/nv-cli-nginx-conf
- npm.io page: https://npm.io/package/nv-cli-nginx-conf

## Dependencies (4)

- [underscore](https://npm.io/package/underscore.md) ^1.13.1
- [nv-cli-basic](https://npm.io/package/nv-cli-basic.md) ^1.0.5
- [nv-dict-basic](https://npm.io/package/nv-dict-basic.md) ^1.0.11
- [nv-facutil-basic](https://npm.io/package/nv-facutil-basic.md) ^1.0.64

## Recent versions

- 1.0.4 (latest) — 2021-07-08
- 1.0.3 — 2021-07-07
- 1.0.2 — 2021-07-07
- 1.0.1 — 2021-07-07
- 1.0.0 — 2021-07-07

## README

nv-cli-nginx-conf
===============
- nv-cli-nginx-conf
- cli tool, nginx conf  for a special format


install
=======
- npm install nv-cli-nginx-conf -g 

usage
=====

ngx\_conf\_init
---------------


        root@dev:/home/dev/NODE# ngx_conf_init -h
        Usage: ngx_conf_init [options]
        Options:
            -o, --output        output js file,default stdout
            -h, --help          usage

        root@dev:/home/dev/NODE#


### examples

    # ngx_conf_init -o nginx.conf




ngx\_conf\_srv
---------------

        root@dev:/home/dev/NODE# ngx_conf_srv -h
        Usage: ngx_conf_srv [options]
        Options:
            -n, --name          conf file name
            -a, --add           add server with ip ,port,domain,ssl,ssl_pem,ssl_key
            -d, --del           delete server with ip,port
            -l, --list          list server
            -g, --get           get server with ip,port
            -i, --ip            server ip
            -p, --port          server port
            -m, --domain        main domain
            -s, --ssl           enable ssl
            -e, --pem           ssl cert pem path
            -k, --key           ssl cert key path
            -o, --output        output js file,default stdout
            -h, --help          usage


### examples

#### add server

    //add server
    # ngx_conf_srv  -a -n nginx.conf -i 127.0.0.1 -p 443 -m local.xyz -s -e /cert/0.pem  -k /cert/0.key -o nginx.conf
    # ngx_conf_srv  -a -n nginx.conf -i 127.0.0.1 -p 883 -m dev.xyz -s -e /cert/1.pem  -k /cert/1.key -o nginx.conf


#### list server

    #ngx_conf_srv  -l -n nginx.conf
    [ '127.0.0.1:443', '127.0.0.1:883' ]


#### delete server


    #ngx_conf_srv  -d -n nginx.conf -i 127.0.0.1 -p 883 -o nginx.conf
    #ngx_conf_srv  -l -n nginx.conf
    [ '127.0.0.1:443' ]
    # 


#### get server

     //get server
     #ngx_conf_srv  -g -n nginx.conf -i 127.0.0.1 -p 443
     listen 127.0.0.1:443 ssl;
     server_name *.local.xyz;
     ssl on;
     ssl_certificate /cert/0.pem;
     ssl_certificate_key /cert/0.key;
     if ($http_host ~* "^(.*?)local\.xyz$") {
         set $domain $1;

     }
     location / {
         tcp_nodelay on;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

     }
     location /static {

     }
     location /http {
         tcp_nodelay on;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

     }
     location /ws {
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection $connection_upgrade;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     }

    
ngx\_conf\_app    
----------------

        root@dev:/home/dev/NODE# ngx_conf_app -h
        Usage: ngx_conf_app [options]
        Options:
            -n, --name             conf file name
            -a, --add              add app with ip ,port,subdomain,static_dir,cmmn_proxy_port,http_proxy_port,ws_proxy_port
            -d, --del              delete app with ip,port,port,subdomain
            -l, --list             list app with ip,port
            -g, --get              get app with ip,port,subdomain
            -i, --ip               server ip
            -p, --port             server port
            -m, --subdomain        sub domain
            -t, --static           static dir
            -c, --cmmn             common service proxy port
            -x, --http             http/https get post... service proxy port
            -w, --ws               websocket service proxy port
            -o, --output           output js file,default stdout
            -h, --help             usage

        root@dev:/home/dev/NODE#


### examples

#### add app

     //add app
     ngx_conf_app  -a -n nginx.conf -i 127.0.0.1 -p 443 -m json       -t /json/       -c 10001 -x 10002 -w 10003 -o nginx.conf
     ngx_conf_app  -a -n nginx.conf -i 127.0.0.1 -p 443 -m img        -t /img/        -c 20001 -x 20002 -w 20003 -o nginx.conf
     ngx_conf_app  -a -n nginx.conf -i 127.0.0.1 -p 443 -m video      -t /video/      -c 30001 -x 30002 -w 30003 -o nginx.conf
     ngx_conf_app  -a -n nginx.conf -i 127.0.0.1 -p 443 -m audio      -t /audio/      -c 40001 -x 40002 -w 40003 -o nginx.conf
     ngx_conf_app  -a -n nginx.conf -i 127.0.0.1 -p 443 -m file       -t /file/       -c 50001 -x 50002 -w 50003 -o nginx.conf
     ngx_conf_app  -a -n nginx.conf -i 127.0.0.1 -p 443 -m doc        -t /doc/        -c 60001 -x 60002 -w 60003 -o nginx.conf
     ngx_conf_app  -a -n nginx.conf -i 127.0.0.1 -p 443 -m db         -t /postgre/    -c 70001 -x 70002 -w 70003 -o nginx.conf
     ngx_conf_app  -a -n nginx.conf -i 127.0.0.1 -p 443 -m bigdata    -t /scylladb/   -c 80001 -x 80002 -w 80003 -o nginx.conf
     ngx_conf_app  -a -n nginx.conf -i 127.0.0.1 -p 443 -m nlp        -t /nlp/        -c 90001 -x 90002 -w 90003 -o nginx.conf




#### list app


     //list app
     #ngx_conf_app  -l -n nginx.conf -i 127.0.0.1 -p 443
     {
       json: App {
         subdomain: 'json',
         static: '/json/',
         cmmn_proxy_port: '10001',
         http_proxy_port: '10002',
         ws_proxy_port: '10003'
       },
       img: App {
         subdomain: 'img',
         static: '/img/',
         cmmn_proxy_port: '20001',
         http_proxy_port: '20002',
         ws_proxy_port: '20003'
       },
       video: App {
         subdomain: 'video',
         static: '/video/',
         cmmn_proxy_port: '30001',
         http_proxy_port: '30002',
         ws_proxy_port: '30003'
       },
       audio: App {
         subdomain: 'audio',
         static: '/audio/',
         cmmn_proxy_port: '40001',
         http_proxy_port: '40002',
         ws_proxy_port: '40003'
       },
       file: App {
         subdomain: 'file',
         static: '/file/',
         cmmn_proxy_port: '50001',
         http_proxy_port: '50002',
         ws_proxy_port: '50003'
       },
       doc: App {
         subdomain: 'doc',
         static: '/doc/',
         cmmn_proxy_port: '60001',
         http_proxy_port: '60002',
         ws_proxy_port: '60003'
       },
       db: App {
         subdomain: 'db',
         static: '/postgre/',
         cmmn_proxy_port: '70001',
         http_proxy_port: '70002',
         ws_proxy_port: '70003'
       },
       bigdata: App {
         subdomain: 'bigdata',
         static: '/scylladb/',
         cmmn_proxy_port: '80001',
         http_proxy_port: '80002',
         ws_proxy_port: '80003'
       },
       nlp: App {
         subdomain: 'nlp',
         static: '/nlp/',
         cmmn_proxy_port: '90001',
         http_proxy_port: '90002',
         ws_proxy_port: '90003'
       }
     }


#### get app 

    //get app

    #ngx_conf_app  -g -n nginx.conf -i 127.0.0.1 -p 443 -m nlp
    {
      subdomain: 'nlp',
      static: '/nlp/',
      cmmn_proxy_port: '90001',
      http_proxy_port: '90002',
      ws_proxy_port: '90003'
    }
    #


#### delete app 



     //delete app
     ngx_conf_app -d -n nginx.conf -i 127.0.0.1 -p 443 -m file -o nginx.conf





LICENSE
=======
- ISC

---
_Source: https://npm.io/package/nv-cli-nginx-conf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
