1

About this issue: Nginx Gunicorn one ip multiple django sites in folders

I've already solve my problem opening multiple ports in my Ubuntu server based in this post https://serverfault.com/questions/655067/is-it-possible-to-make-nginx-listen-to-different-ports, but I still have a few questions about that:

  1. Is it correct to open multiple ports to serve multiple instances for the same app?

  2. If that is correct, how can I hide the port in the url for the users? To access one instance, they (the user) must type "http://1.1.1.1:81/app1/" or "http://1.1.1.1:82/app2/". Is this a good idea?

Thanks!

Rob
  • 14,746
  • 28
  • 47
  • 65
Sommer
  • 1,328
  • 2
  • 10
  • 20
  • 1
    You can't use a custom port and not have it in the URL. http://site.example/ is a shorthand for http://site.example:80/ and similarly the port implied by https is 443 and if it's a different port you have to have it explicitly in the URL. – tripleee Nov 27 '17 at 06:35
  • 1
    @tripleee thanks for ur clear answer! – Sommer Nov 27 '17 at 15:31

2 Answers2

1

Instead of routing based on ports, I would route based on either domain name or subdomain name. So, instead of www.mysite.com:8000, www.mysite.com:8001, and so on, you would have something like subdomain1.mysite.com, subdomain2.mysite.com, etc.

Here's another discussion that covers this: route different proxy based on subdomain request in nginx

Clinton
  • 313
  • 1
  • 5
1
  1. Yes, you could do that. I would also say you should utilize multiple subdomains as seen in the above answer.
  2. That is not bad, as you only define a specific port. I have also done it and it works just as normal.
Viper
  • 46
  • 1