On Sep 8, 2015, at 8:20 PM, Aaron Martone wrote: > I've heard of NGINX, but have no experience with it. Since it's an additional > server, I can only assume that it would be an additional expense to get up > and running with my VPS, so let me see if I can find a solution at no > additional expense before I go down that road.
If by "expense" you mean monetary, you'll have to ask your VPS provider. I thought the point of a Virtual Private Server was that you can run whatever programs you want on it; I didn't think they would charge you by the program. If you mean CPU or memory expense, then I don't know. If you're writing a program to do the subset of nginx's functionality that you want, it's possible your custom program will use less CPU or memory than nginx. On the other hand, nginx has been in development for years and is probably highly optimized. The expense (in terms of time and effort) of writing your own code to do what nginx already does would probably be greater than spending a little time with the nginx documentation to see how to use it. Again I'm not sure if I understood your goals correctly, and it might be that you want to do something that nginx can't do. But if you don't know nginx yet, you probably owe it to yourself to investigate it first. Maybe using it can save you some time, if not for this specific task then maybe for something else later. > I noticed that Node uses a 'http' and 'https' module for its respective > .createServer() method. Is it wise to run multiple apps off 1 Node process? > Or do most VPS (using Digital Ocean) allow you to spin up multiple Node > processes, each independent from another? >From an organizational perspective, you probably want a separate process >running each app. If they were really meant to run together, why would you >make them separate apps in the first place? > Using the aforementioned apps, if I ran: > > > node /hosts/www/app.js > > node /hosts/api/alpha/app.js > > node /nosts/api/beta/app.js > > in 3 separate terminal processes? Running (multiple) apps from (multiple) terminals is great for testing. For production use, of course, you'll want something more robust, that doesn't rely on a terminal, and that automatically restarts processes in case of failure. Each OS has its own way of handling that, so consult your VPS operating system's documentation for how to do it on your VPS. > Correct me if I'm wrong, but I think someone said that I must have a unique > endpoint per application. The PROTOCOL + DOMAIN + PORT = the endpoint. So if > all these apps were running on, say 443 (PORT) and HTTPS (PROTOCOL), then I'd > have to have a unique DOMAIN. That's fine for the www.domain.com app, but the > 2 apps on api.domain.com that just have different starting paths > (api.domain.com/alpha and api.domain.com/beta) probably can't be done that > way. I'd have to have an Express app per the 'https://api.domain.com:443' > endpoint, and then it would have to read the url path and internally load the > 'alpha' or 'beta' apps. And that's not too much of a problem if I'm right in > all my assumptions. :) Sure, each app that wants to listen on a port/IP must listen on a different port/IP. That's why usually people run nginx on the public port/IP (for example port 80 and/or 443 on your public IP), and run as many node apps as needed on private ports (port 3000, 3001, etc. on localhost or other private IP) and configure nginx to pass the appropriate requests to the appropriate app, based on the hostname or path or whatever. -- 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/EB68CD72-8044-4363-AB85-DB5962DA8E23%40ryandesign.com. For more options, visit https://groups.google.com/d/optout.
