Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have one subdomain (dyndns). xyz.dyndns.com (f.e.)
Here my question begins:

  • I have a server for virtualisation.
  • On the server I have multiple VMs where different web-services are available through https.
  • My router is configured with xyz.dyndns.com
  • VMs can be accessed over NAT or be Bridged to router

How is it possible to access VM_1's and VM_2's WebService like:
https://xyz.dyndns.com/vm_1_webservice or

Because I need to add redirection rules to router.
I know that with bridging the VMs I can simply redirect http to the VM on router.
In my local network I have configured anything with DNAT (iptables).
I.e. when I go trought localhost(server):40001(port) f.e. I will be redirected to VM_1's WebService which is accessible through SSL. Like:
It works good. How to go on?(with nginx or apache on host?)

share|improve this question
up vote 2 down vote accepted

The typical approach is to setup a web server such as Nginx or Apache on either the router/switch box, or have the router/switch box redirect ports 80 & 443 to a internal host that's running Nginx or Apache.

Once traffic has been setup so that it's passing to a web server, you can then setup virtual hosts within the web server, which can take care to route the traffic to the appropriate vm1_webservice, vm2_webservice, etc.


I'll show you 1 basic Nginx method but you can get very elaborate with these rules once you grok how it works. Also take a look at this tutorial titled: How nginx processes a request which shows how you can configure Nginx to service multiple sites on a single port 80/443.

server {
  server_name www.example.com
  location / {
    proxy_pass http://localhost:4567/;

server {
  server_name www.example2.com
  location {
    proxy_pass http://localhost:4568/;

You'd change the proxy_pass lines to match whatever port @ host your vm1_webservice was running on, for example.

share|improve this answer
As I thought. Thank you – x4k3p Jan 23 '14 at 4:17
@x4k3p - you're quite welcome, thanks for the Q. – slm Jan 23 '14 at 4:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.