# port-vhoster

> A simple HTTP vhost reverse proxy / port sharing implementation for node.js. Run multiple node HTTP servers (Domains, IP's) through one port.

Latest version **0.1.16** (published 2012-12-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install port-vhoster
pnpm add port-vhoster
yarn add port-vhoster
bun add port-vhoster
```

Provides the command `port-vhoster`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.16 |
| Published | 2012-12-29 |
| First published | 2012-12-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.* |
| Dependencies | 2 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Aron Homberg |
| Maintainers | kyr0 |
| Keywords | multi, vhost, port, reverse, proxy, http |

## Links

- npm: https://www.npmjs.com/package/port-vhoster
- Repository: http://github.com/kyr0/port-vhoster
- Homepage: http://github.com/kyr0/port-vhoster/
- npm.io page: https://npm.io/package/port-vhoster

## Dependencies (2)

- [optimist](https://npm.io/package/optimist.md) 0.3.x
- [http-proxy](https://npm.io/package/http-proxy.md) 0.8.x

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads

## Recent versions

- 0.1.16 (latest) — 2012-12-29
- 0.1.15 — 2012-12-28
- 0.1.14 — 2012-12-28
- 0.1.13 — 2012-12-28
- 0.1.12 — 2012-12-28
- 0.1.11 — 2012-12-28
- 0.1.10 — 2012-12-28
- 0.1.9 — 2012-12-28
- 0.1.8 — 2012-12-28
- 0.1.7 — 2012-12-28
- 0.1.6 — 2012-12-28
- 0.1.5 — 2012-12-28
- 0.1.4 — 2012-12-28
- 0.1.3 — 2012-12-28
- 0.1.2 — 2012-12-28
- … 2 more at https://npm.io/package/port-vhoster/versions

## README

port-vhoster
==========

A simple HTTP vhost reverse proxy / port sharing implementation for node.js. Run multiple node HTTP servers (Domains, IP's) through one port.

This project implements a simple HTTP multi domain name / IP / directory HTTP reverse proxy for virtual hosting / port sharing.
It simply does what a reverse proxy does combined with some mod_rewrite feature support.

This project also shows the power of node.js by being implemented in less than 100 lines of code.

PERFORMANCE NOTICE:
This code has NOT been tested in production / high load environments.
So be warned and evaluate it on your own before using it in production. Feedback is welcome!
(It SHOULD be NOT LESS faster than the http-proxy module implementation.)

## Prerequisites

Make sure:
- node.js is installed (>= 0.8.*)
- npm is installed

## Installing

```

    [sudo] npm install -g port-vhoster

```

## Configuring

A valid configuration file for port-vhoster is written in JSON notation as a single object that should provide
three key/value pairs:

- description (String) = Description, printed to the terminal on startup.
- port        (Number) = Source port (share port) to listen to (e.g. 80).
- vhosts      (Object) = Key ($ip OR $domain/port) / value (target $ip:$port/$path)-pairs of vhost-configurations.

## Configuration example

The following configuration is a simple routing example. You can add more vhosts to the config object too:

```

    {
        "description": "Routing with port sharing on port 80 (HTTP) for some domains and paths...",
        "port": 80,
        "vhosts": {
            "www.aron-homberg.de": "127.0.0.1:8081",
            "aron-homberg.de": "127.0.0.1:8081",
            "example.com/downloads": "10.0.0.1:8080",
            "example.com/uploads": "10.0.0.2:8080/master/golive/upload"
        }
    }

```

Take a look at the [examples](https://github.com/kyr0/port-vhoster/tree/master/examples) directory for more inspiration.

## Running

By default, ```port-vhoster``` searches for a config file called ```port-vhoster.json``` in current working directory.
If you want to use a different name, run ```port-vhoster``` with the optional argument to name the config file:

```

    [sudo] port-vhoster [$alternative-config-file.json]

```

You may need super-user permissions if you want ```port-vhoster``` to listen to a port below 1024 (e.g. port 80).

## Logging and running in stand-alone mode

If you're on a Unix/Linux/Mac OS X system you can run port-vhoster in server mode easily:

Starting (e.g. ```start-vhoster.sh``` - don't forget to: ```chmod +x start-vhoster.sh```!):

```
    #!/bin/sh
    echo "Starting port-vhoster..."
    nohup port-vhoster > port-vhoster.out 2> port-vhoster.err < /dev/null &

```

Stopping (e.g. ```stop-vhoster.sh``` - don't forget to: ```chmod +x stop-vhoster.sh```!):

```
    #!/bin/sh
    echo "Stopping port-vhoster..."
    kill $(ps aux | grep '[p]ort-vhoster' | awk '{print $2}')

```

For sure, server mode and logging may also be possible on Microsoft Windows platform but that's currently untested.

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