3

I have a small lab at home with several virtual machines that each has a web application:

http://vm1:8080

http://vm2:8081

http://vm3:8082

I also have a free dynamic DNS service (noip.com) that I configured on my internet router. address for example : home.ddns.net

is it possible to use Nginx as a reverse proxy to serve each web application as a subdomain to the home domain/subdomain ?

like this:

http://app1.home.ddns.net:8080 => http://vm1:8080

http://app2.home.ddns.net:8081 => http://vm2:8081

or even this: (use port 80) ?

http://app1.home.ddns.net => http://vm1:8080

http://app2.home.ddns.net => http://vm2:8081

if that is not possible, can I use it like this? :

http://home.ddns.net/app1 => http://vm1:8080

http://home.ddns.net/app2 => http://vm2:8081

my question seems simple but I was not able to find an answer online and on stackoverflow :(

Thanks

Misbah
  • 33
  • 1
  • 1
  • 3

2 Answers2

3

All variants are possible, but second one is best and simple.

server {
    listen 80;
    server_name app1.home.ddns.net;
    location / {
        proxy_pass http://vm1:8080;
    }
}

server {
    listen 80;
    server_name app2.home.ddns.net;
    location / {
        proxy_pass http://vm2:8081;
    }
}

See http://nginx.org/en/docs/http/request_processing.html

Alexey Ten
  • 13,794
  • 6
  • 44
  • 54
1

I'm managing a custom server under a NO-IP subdomain (*.hopto.org, instead of *.ddns.net, but basically is run by the same company) and this seems not be possible. While Alexey's answer may be correct regarding the nginx configuration, as of today, NO-IP doesn't allow sub-subdomains.

See last part of this answer for more details. But basically this would mean allowing everyone to become re-sellers themselves.

knockergrowl
  • 11
  • 1
  • 3