The Virtual Hosts are the elements within the Cloud-Bricks
Web System, that helps to connect the Web requests received by the
Cloud with HTTP servers that will address these requests. The
Virtual Host decides to which server to route requests based on the
domain of the site that is being requested.
Basic concepts of Virtual Host
To understand how it works and how to configure a Virtual Host,
several related concepts need to be learned.
is the communication protocol that allows a browser talk to a Web
server to exchange data. HTTPS adds a layer of security in
communication, enabling data encryption using TLS/SSL.
To configure a Virtual Host HTTPS, you must first configure a digital certificate.
Locations are elements that allow separate a Website in areas or
different folders each with independent settings.
From a location you can set access restrictions, indicate which HTTP
server must manage content, generate and control the cache
The locations also manage the destination of the request, so it
is possible to direct requests from one domain to a specific HTTP
server, or redirect to an external URL. When you set up a
redirect, the destination field appears: put here the url where we
want to redirect the user.
Stale Cache: If the reverse proxy has in memory an
already expired copy of a page (ie your cache time has expired)
and for some reason it is not possible to obtain an updated copy
(Example: the web server is offline), then we authorize the
proxy to deliver an "old copy" of the site/page by every
request. In this way we can deliver an old copy rather than
failing to deliver nothing or generate an error.
Cookie no cache: This option is especially useful when
the Web site uses an authentication system, and through a
specific cookie indicates that the content generated during the
session should not be stored in the cache. By activating this
option the field appears to enter the name of the cookie.
The HTTP redirect is an option to send the traffic to external
sites. The redirect can be useful for example, if we have a
website maintenance and all traffic is redirected to a different
site. Redirect is in the field "Destination" within locations. You
can choose between two types of redirect:
Redirect 301 (Permanente): This redirect indicates that the
host has been able to communicate with the server but the
requested file has been moved to another address permanently.
Redirect 302 (Temporal): This redirect indicates that the host
has been able to communicate with the server but the requested
file has been moved to another address temporarily.
Go to Web System -> Virtual Hosts on the left menu.
For a website to be visible on the Internet it is necessary to
create a virtual host and configure the domains associated with it.
Virtual host name, there can not be two identical names.
HTTP: Normal protocol for Web sites, without security.
HTTPS: Secure web protocol, uses SSL security layer. For
more information go to the SSL
HTTP & HTTPS: You will be able to access your website
using secure (HTTPS) and insecure (HTTP) connections.
Button to add domains: You can setup multiple virtual
domains on a single host.
Domain name: Here you can add all domains that have been
purchased and are pointing to the Cloud.
We can also put the domain name system default which has the virtualMachineName.customerName.vnat.net
Domains delete button: Delete domains that have been
Add Location button: Lets add multiple Locations that
can be configured independently.
URI : A URL is simply a URI that happens to point to a
physical resource over a network
For this example we will use the root of the website "/".
Access Restriction: You can allow access to a single network
configured on machines
and Networks firewall section.
For this example we will give access to any machine on the
Internet with ANY option.
Virtualhost destination: It is the destination Traffic
It can be a Redirect 301 or 302, or an HTTP server.
For more information go to the HTTP
For this example we will use a previous HTTP server called
Option to enable HTTP cache Cloud-Bricks. For this example
we'll leave unchecked.
Locations delete button: You can delete Locations created, this
task is irreversible.
OK button: When you click it, the Virtual Hosts list in
the previous screen is updated.
Cancel button: Cancels operations made.
Click on the OK button and then click Commit Changes
to save the changes. You can now access the web site using any of
the configured domains.
For security reasons, it is often necessary to restrict access to
a directory or URL of the portal. For example when you are
creating a new section of a portal which is in the URI /sports
we can restrict access to only developers can join. Next, an
In the "Allow" field choose the network that will have exclusive
access to the URI of /wordpress, for this case choose the
GOOGLE_DNS_IPV4 network. By entering the URL again http://wordpress.pruebas.vnat.net/wordpress/
access is restricted.
The redirect are useful for controlling access to portals
development or maintenance option. You can redirect traffic to
external sites or servers. To add a redirect to a portal is
necessary to modify the virtual host configured. For example when
entering the web portal http://wordpress.pruebas.vnat.net/google
throws 404 error.
Now change the Virtual Host corresponding to include a redirect
to the portal www.google.com
You can make different parts of the same web site are served by
different HTTP servers.
As an example, suppose we want on our web site, the URI /support
is server by a specific HTTP server.
If we have virtual machine as support server(tickets system), you
must create an HTTP server
pointing to the port and IP of the machine.
Update List and commit changes. Altering the Virtual Host, Now you
can edit the locations and add the new URI, changing the option
"Destination" to point to the HTTP server you just created.
In this way it is possible to create and distribute the locations
between different servers.
In the last Version of the Cloud-Bricks platform you may use the NGINX
rule engine to create return and rewrite rules in order to
control how your web sites behave according to different conditions.
Previous knowledge in Regular
Expressions is required in order to be able to configure
rewrite rules. Perl syntax is used, however no quotes (" , ')
neither slashes (/) are necessary to enclose regular expressions.
rewrite_i: Internal redirect. Use regular expressions
to match/replace the current URI without sending any redirect
to the client. The URI will be modified before sending it to
the back end virtual machine web server.
rewrite_t : Use regular expressions to match/replace
the current URI and issue a HTTP 302 Redirect back to the
client if the match is successful.
rewrite_p: Use regular expressions to match/replace
the current URI and issue a HTTP 301 Redirect back to the
client if the match is successful.
Fields for returning HTTP codes in return rules:
For codes 3XX (redirects) an absolute URL must be provided
as the redirect destination.
Special non-standard code 444 is used to close the current
connection without sending any answer to the client.
Other codes may send an optional response text to the