different Subdomains pointing to same droplet ip with different ports

August 6, 2017 123 views
Getting Started Ubuntu 16.04


I am trying have different sub domains resolving to the same IP (same droplet) but with different ports, pointing to single nginx server; which in turn points to apache.

I am trying to set some thing like this . point to droplet ip with port 80 point to droplet ip with port 8081 point to droplet ip with port 8080

and so on.

I have currently set up nginx to listen to port 80 and forward to apache @ port 8080 which works fine.

But I am confused how should go about to do the same for sub domains.

I set up the nginx server soley ofr proxy server as several article point to same, iam not sure this is re right direction I am in.

i did find a similar question

but the answer here is not exactly what my question is and also very vague for a beginner like me.

Any help in this regard will be highly appreciated.

1 Answer

long story short

I want to redirect to and I want to preserve the original sub-domain name the url of the browser.

Have another answer? Share your knowledge.