ios - Host multiple mobile apps on one node server? -


i have been configuring centos vps host various services mobile apps using node.js.

with research, i'm sure can manage deploy node.js server 1 application, how go separating services on server go through port 80?

i thought using different port each app, port 3000 mobileapp1, port 30001 mobileapp2, after reading several posts came conclusion bad idea. because firewalls configured allow connections port 80 , may want create sites utilize same web services mobile clients.

i found site recommended using proxy so:

    var http = require('http') , httpproxy = require('http-proxy');  httpproxy.createserver({   hostnameonly: true,   router: {     //web-development.cc     'www.my-domain.com': '127.0.0.1:3001',     'www.my-other-domain.de' : '127.0.0.1:3002'   } }).listen(80); 

how can support various web services may called either mobile apps or 1 of web pages , have go through port 80?

yes, can use node proxy , have run on port 80, routing requests based on url various node applications, or can run web server on port 80, , have route requests node applications. there lot of proxy options within node, here it's going more opinion should use. 1 option i've had success web framework hapi walmart has used route requests application servers. here's documentation on how used hapi proxy requests.

another, possibly more used option use web server such apache or nginx on port 80 (and 443) , have route requests application servers based on urls. there's lot of documentation out there on how set up, since lot of people route requests. i've put gist remember how setup simple nginx server route requests based on domain separate node applications, can find here: https://gist.github.com/dylants/8609050. (note gist expects ssl enabled on connections, gives idea.)

but @ high level, it's fine (and quite normal) run multiple node applications on same machine on different ports (my gist pasted environment this). can restrict access outside world on ports (say 3000, 3001, 3002, etc) , allow access on ports 80 , 443. have web server runs on port 80 , 443, , routes requests node applications running on ports 3000, 3001, etc.

the thing using these web servers they're easy once understand basics, , run without maintenance @ after that. may have little bit of research initially, it'll worth in end. hope helps :)


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -