1

So I've got my site setup with nginx and gunicorn.

However I'm not using port 80 for the site, instead I'm using port 8888. Is it possible to tell the domain name to use port 8888 instead of 80 when connecting through mydomain.net?

Currently I will have to connect with mydomain.net:8888. Can this be done with nginx if it cannot be done on the domain name side?

zentenk
  • 223
  • 1
  • 5
  • 10
  • possible duplicate of [How to use DNS to redirect domain to specific port on my server](http://serverfault.com/questions/74362/how-to-use-dns-to-redirect-domain-to-specific-port-on-my-server) – Bryan Feb 11 '12 at 17:45

1 Answers1

5

No, and you misunderstand the role of the various technologies here.

DNS turns the domain name into an IP address. It has no information about the port to connect to; that can only be changed on the client side, and current web browsers have no mechanism to look up the port dynamically.

You can make it work in nginx, in the sense that you could make nginx serve your application on port 80. Nothing else will work; it can't change browser behaviour any more than anything else can.

Your question is really "can I make browsers connect to a port other than 80, by default, even though they are not told to, when using HTTP?", and still, no.

Daniel Pittman
  • 5,842
  • 1
  • 23
  • 20
  • 1
    Technically DNS *can* turn a domain name into an address + port, by using SRV records rather than A records, but I don't think any web browsers support that :( – Shish Feb 12 '12 at 06:24
  • [To the shame of their authors](http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/dns-srv-record-use-by-clients.html), you're still pretty much right, even though one popular browser has had the code for six years now. Note also that your statement is only true for _browsers_. I've been browsing the WWW through a SRV-aware proxy for some years. – JdeBP Feb 12 '12 at 12:33