I work with sub domains on my live and test systems, but with single
host on my dev and sandbox systems.
I use express as the web framework and my first route is something
like this:
app.get('*', function(req, res, next) {
var host = req.headers.host;
var url = req.url;
if (host === env.vHost1) {
req.url = '/vHost1' + req.url;
} else if (host === env.vHost2) {
req.url = '/vHost2' + req.url;
} else if (host === env.vHost3) {
req.url = '/vHost3' + req.url
} else if (host === env.vHost4) {
req.url = '/vHost4' + req.url;
}
next();
});
Pretty simple, but works for me (just followed KISS). If the number of
vhosts increased I would just add the host part to the url without
going through if clauses.
I made it like this, because on my dev instance, for example, I only
have localhost and all the links in my navigation bar adjust
accordingly. I built a relationship between my environment and my
links.
Up to now, I didn't face any problems with the live system and adding
another vhost has been as simple as adding another if clause.
Regards,
Lothar
On Apr 7, 3:46 pm, "john.tiger" <[email protected]> wrote:
> you can use node-http-proxy as your front-facing server - look at the
> examples. It has been pretty solid.
>
> On 04/07/2012 01:38 AM, Alan Hoffmeister wrote:
>
>
>
>
>
>
>
> > I would like some guide for deploying multiple hosts on the same
> > machine, Haibu seems to do the trick very well, where can I find some
> > extended documention about it?
>
> > Thanks!
>
> > Em s�bado, 7 de abril de 2012, Erich Kolb escreveu:
>
> > What would you like to know?
>
> > *From:*[email protected] <javascript:_e({}, 'cvml',
> > '[email protected]');> [mailto:[email protected]
> > <javascript:_e({}, 'cvml', '[email protected]');>] *On
> > Behalf Of *Alan Hoffmeister
> > *Sent:* Friday, April 06, 2012 10:23 PM
> > *To:* nodejs
> > *Subject:* [nodejs] vHosts, someone?
>
> > Hello there,
>
> > Someone could share any kind of experience with running multiple
> > websites on a single host?
>
> > Thanks.
>
> > --
> > --
> > Att,
> > Alan Hoffmeister
>
> > --
> > Job Board:http://jobs.nodejs.org/
> > Posting guidelines:
> > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > You received this message because you are subscribed to the Google
> > Groups "nodejs" group.
> > To post to this group, send email to [email protected]
> > <javascript:_e({}, 'cvml', '[email protected]');>
> > To unsubscribe from this group, send email to
> > [email protected] <javascript:_e({}, 'cvml',
> > '[email protected]');>
> > For more options, visit this group at
> > http://groups.google.com/group/nodejs?hl=en?hl=en
>
> > --
> > Job Board:http://jobs.nodejs.org/
> > Posting guidelines:
> > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > You received this message because you are subscribed to the Google
> > Groups "nodejs" group.
> > To post to this group, send email to [email protected]
> > <javascript:_e({}, 'cvml', '[email protected]');>
> > To unsubscribe from this group, send email to
> > [email protected] <javascript:_e({}, 'cvml',
> > 'nodejs%[email protected]');>
> > For more options, visit this group at
> > http://groups.google.com/group/nodejs?hl=en?hl=en
>
> > --
> > --
> > Att,
> > Alan Hoffmeister
> > --
> > Job Board:http://jobs.nodejs.org/
> > Posting guidelines:
> >https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> > You received this message because you are subscribed to the Google
> > Groups "nodejs" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/nodejs?hl=en?hl=en
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en