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?

1

1 Answer 1

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.

2
  • 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, 2012 at 6:24
  • To the shame of their authors, 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, 2012 at 12:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .