Mobile app version of vmapp.org
Login or Join
Jennifer507

: Managing (routing between) two separate servers in the same web app I am building a website, where the landing page and some other content is based on node, express, angular2 etc. I want

@Jennifer507

Posted in: #NodeJs #StaticContent #Vhost #WebHosting

I am building a website, where the landing page and some other content is based on node, express, angular2 etc.

I want to have a subdomain (blog.mydomain.com) which runs Hexo. On my development machine, I run hexo server to test the blog on localhost:4000. I can deploy to heroku by running hexo generate -deploy. So I have two questions - if I had a node app, where one of the sub-directories contained my current hexo project, how would I deploy it, as if I just uploaded the content, what would trigger hexo to run?

Secondly, how to I route from my main app, to the blog? I have seen a number of suggestions to use vhost with express. Would I run the two servers through different ports, and then just route /blog routes to0.0.0.0:4000 for example?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Jennifer507

1 Comments

Sorted by latest first Latest Oldest Best

 

@Marchetta884

You'll need to run both node apps on different ports, I suggest using PM2, which is a free and popular tool.
Then you'll need to route from the different domains or folder to different ports.
NGINX is a very powerful tool, yet using apache is much easier to configure and will do what you need.

Here's how you might want to set your routing: example.com:80 >> localhost:80
blog.example.com:80 >> localhost:4000
OR example.com >> localhost:80 example.comblog >> localhost:4000

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme