node.js - How to run more than one app on one instance of EC2 -


i have couple of small production sites , bunch of fun hobbyist/experimental apps , such. i'd run of them on 1 ec2 instance.

can install node.js, npm, express , couchdb once, , run each app on different port, , adjust dns settings @ domain registry point appropriate place?

update: mike! else who's looking multiple ip addresses on ec2: http://docs.aws.amazon.com/awsec2/latest/userguide/using-instance-addressing.html

there multiple ways go it.

different ports

you run each node.js process on different port , open ports world. however, urls need port on end of hostname each project. yoururl.com:8080/ technically work, not you're looking for.

multiple ip addresses

you use multiple ip addresses on 1 ec2 instance, however, come additional cost of $3.65 month each. if have 10 different domains want host on once instance that's on $30 month in hosting fees.

on flip side, domain using ssl needs it's own ip address.

also, there limits number of ip addresses can assign instance , smaller instance, less ip addresses get.

the number of ip addresses can assign varies instance type. small instances can accommodate 8 ip addresses (across 2 elastic network interfaces) whereas high-memory quadruple large , cluster computer 8 large instances can assigned 240 ip addresses (across 8 elastic network interfaces). more information ip address , elastic network interface limits, go instance families , types in amazon ec2 user guide.

express vhosts

express comes virtual host functionality. can run multiple domains under 1 node.js/express server , setup routes based on domain name. vhost under express enables this.

reverse proxy

you can setup nginx in front of multiple application servers. has flexibility. can have 1 node.js process per domain allows updates , restarts on 1 domain @ time. allows host applications servers such apache/php under same ec2 instance along side node.js process.

with nginx acting reverse proxy host different application servers under same domain, serving different paths.

for instance, node.js serve main root path of domain setup /blog/ path go apache/php/wordpress setup on same ec2 instance.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -