Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why webservers use port 80 for real applications?

Tags:

deployment

Just curious. When developing with Casini development server, one has an infinite number of ports. But, the production servers seem to give a particular importance to port 80.

Has that to do with a technical requirement, a convention, or both? I've checked the web but haven't been able to find a clear response so far.

Thanks for helping.

like image 242
Richard77 Avatar asked Dec 17 '22 21:12

Richard77


2 Answers

Many services have specifically-assigned ports This allows users to type, for example http://stackoverflow.com and get the website for SO, without needing to enter a port as well. This isn't a technical requirement; however, using a different port requires the user to know an extra piece of information, which must be entered into the URL every time.

like image 142
Kevin Lacquement Avatar answered Jun 09 '23 17:06

Kevin Lacquement


When you connect to a server via TCP/IP you specify particular port you connect to. You do not connect to a server and hope that server guesses which port you would like to talk to.

So in most cases you tell browser to use protocol http, say "http://example.com/" then browser uses default port number assigned to that protocol (http) to connect to server "example.com". In this case port is 80. If for example you specify "https://example.com/" then browser looks for default port for https and then connects to port 443 instead.

So if you do not want to tell to every of your users to specify some non-default port for your service (say "http://example.com:60765/") you better use default one.

BTW there is a way to get port number your service listens to by it's protocol name (by asking a service's host's daemon at port 0) but this method seems to be rarely used (if at all).

See also other answers: default protocol numbers are assigned by IANA

like image 25
Petr Gladkikh Avatar answered Jun 09 '23 17:06

Petr Gladkikh