E
E
Eugene Obrezkov2013-12-25 16:01:59
Node.js
Eugene Obrezkov, 2013-12-25 16:01:59

How to raise two hosts on Node.js + Sails?

Good afternoon.
There is a problem of raising the project to Sails + Node.js. The catch is that you need to make two domains: beta.site.com and site.com . The projects are located at /var/www/html/beta.site.com and /var/www/html/site.com respectively.
To raise a server for a specific project, execute the node app.js command in the /var/www/html/beta.site.com directory , for example.
The question is as follows. How can you raise both beta.site.com and site.com, but in such a way that when you navigate to beta.site.com in the browser, the project opens in /var/www/html/beta.site.com and, accordingly, with site. com.
As I understand it, you need to somehow configure virtual hosts in nodejs itself? Who can tell in which direction to dig?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2013-12-25
@ghaiklor

Take out the domain in the settings, like this:

// /var/www/html/beta.site.com/settings.js
module.exports = {
    domain: 'beta.site.js'
}

// /var/www/html/site.com/settings.js
module.exports = {
    domain: 'site.js'
}

// app.js
var express = require('express');
var app = express();
// ...

app.listen(3000, require('./settings').domain)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question