I have an EC2 instance running Ubuntu 12.04. I've got nodejs and mongo installed. This instance also has an IP address allocated to it.
I'd like to have my application (a nodejs app) running from a directory (let's say /var/www/node/my_app) connected to a local mongo db (I've installed the db manually and its not from Amazon marketplace, however this is for development/tests purposes so at the moment performance is not an issue). I'd like then to have a domain linked with the ip address (this was done through my domain provider and is ready) in turn linked to my app (running from /var/www/node/my_app) so when I go to www.mydomain.com I'll see my app running on my web browser.
I'd also like to be able to have a different app running from /var/www/node/my_app2 that could be accessed through another domain or a subdomain (app2.mydomain.com for instance).
I can do all that very easily using PHP/MySQL/Webmin/Apache. All I need to do is have my application on a particular folder and have webmin to manage/create virtual hosts pointing a particular domian/subdomain to it.
My question is: can someone, explain to me, step by step (or point me to a tutorial/site/documentation) how I can have the same setup using node? I understand it'll probably means installing other pieces of software (something like nginx for instance)?
Background: I have read many tutorials on how to start with node in which they explain how to install node on your local machine, create a server to listen to a port (something like 8080) and if I visit http://localhost:8080
on my local computer it works (Yes, I've tried and it does work) however I cannot replicate the same on my EC2. Not to mention that I'd rather not use www.mydomain.com:8080 (for instance) and would prefer to have the ability to run more than one app from the same domain (using subdomains).
Can anyone help?
Many thanks