Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
possible duplicate of How to use DNS to redirect domain to specific port on my server –  Bryan Feb 11 '12 at 17:45
add comment

1 Answer 1

up vote 5 down vote accepted

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.

share|improve this answer
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 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 '12 at 12:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.