July 2012
Beginner to intermediate
342 pages
7h 27m
English
If we wish to host multiple sites on one server, we can do so with virtual hosting. Virtual hosting is a way to uniquely handle multiple domain names according to their name. The technique is surprisingly simple: we just look at the incoming Host header and respond accordingly. In this task, we're going to implement simple name based virtual hosting for static sites.
We'll create a folder called sites, with localhost-site and nodecookbook as subdirectories. In localhost-site/index.html we'll write the following:
<b> This is localhost </b>
And in nodecookbook/index.html we'll add the following code:
<h1>Welcome to the Node Cookbook Site!</h1>
For local testing, we'll want to configure our system ...
Read now
Unlock full access