We wrote a CLI to automate nginx configuration as a reverse proxy for one 
or more node apps on a VPS, which is your exact use case. Check it out:

https://www.npmjs.com/package/mechanic

On Tuesday, September 8, 2015 at 2:11:42 PM UTC-4, Aaron Martone wrote:
>
> Relatively new to Node, so if I make a statement that is outright wrong, 
> please let me know.
>
> Let's say I have 3 Express apps over 2 domains:
>
> *Default website*: www.domain.com (/hosts/www/app.js)
> *Alpha API website*: api.domain.com/alpha (/hosts/api/alpha/app.js)
> *Beta API website*: api.domain.com/beta (/hosts/api/beta/app.js)
>
> I'm looking to build an infrastructure that allows me to handle routing 
> all incoming requests through a central "AppRouter" that looks at the 
> Protocol, Domain and Port combination (what I'm calling an 'endpoint') to 
> know which app to route the request off to. For example, if it sees:
>
> https://www.domain.com/this/that,
>
> it'll know that: "With protocol 'https' and domain 'www.domain.com' and 
> port: 80, I send this to the 'Default website' express app (which takes 
> over from that point to process the '/this/that' or remainder of the path 
> in the url.
>
> My problem I'm encountering, is that in order to bring up a 'AppRouter' 
> application, I have to specify a port to bind to. So if I bind it to port 
> 80, I'll miss all requests on https (443) or other ports I might want to 
> support.
>
> Am I taking the wrong approach to this functionality, or am I too complex 
> in my approach? Does node support a more simplified approach to this 
> problem like "Just spin up a node instance per app", etc.  I'm using a VPS 
> hosting, and am new to it as well, so I appreciate any feedback from 
> someone whose been in a similar situation.
>

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/74ba3672-c904-4168-a8f7-e43ecfaf8b3d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to