William Thomas
William Thomas

Reputation: 2126

Hosting multiple MEAN stack apps on one VPS

I am learning how to develop MEAN stack applications and have gotten as far as deploying an app to an AWS EC2 instance running Ubuntu. Everything works, but I'm wondering if there is a way to host multiple apps on separate "directories".

So for example:

I know I could do something like this by writing the necessary routes into a single app.js file, but I'm really looking for a way to keep app1 and app2 as separated as possible.

Is this even possible? Or are Node apps only suited to live alone at the root of its deployment location?

Upvotes: 0

Views: 621

Answers (1)

mrvautin
mrvautin

Reputation: 300

As above. Nginx will do the job. Something like this for each app:

server {
listen 80;

server_name example.com;

location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $host;
}
}

More reading here: https://www.digitalocean.com/community/tutorials/how-to-set-up-a-node-js-application-for-production-on-ubuntu-14-04

Upvotes: 1

Related Questions