Not necessarily. Ports 80 and 443 are the standard ports for HTTP and HTTPS respectively. However, in many situations, you can use others.
For example, my tomcat goes up on port 8080. When I put two services on my machine, one goes up on 8080 and the other on 8081.
In practice, you can use http://www.example.com:1234
to denote that you want to access the www.example.com
site via HTTP on port 1234. When using https://www.example.com:1234
, you use HTTPS instead of HTTP. When the port number is omitted / missing, port 80 will be used if it is HTTP or 443 if it is HTTPS.
In theory, nothing would stop you from making your site available on the door you want, and there are some sites that actually do that. However, this does not usually work out very well because there are many firewalls out there that block connections on ports that are not explicitly freed, and whereas ports 80 and 443 are the standard HTTP and HTTPS ports used by 99% of the sites worldwide , they are usually always released, whereas when using the other ports, you may have problems with users reporting that they can not access your site properly.
Another advantage of using default ports is that you do not need to put the port number on your URLs, which tends to be desirable for most websites. Also, when the user types a URL in the browser, he will probably try typing www.example.com
instead of www.example.com:1234
.
On the other hand, by not being forced to use the default port at all times, more than one HTTP / HTTPS service can be made available on the same machine. Since the ports in use are reserved for the services that listen to them and it is not possible to run two services at the same time on the same machine, the same IP and the same port, so if you have a service running on the HTTP protocol on port 80 and you want provide another service that also runs the HTTP protocol on the same machine with the same IP, then you will have to use a different port. But when using a non-standard port, it will fall into the problems described above. For this reason, some people use proxy / gateway services, where the proxy / gateway is an HTTP / HTTPS service that uses standard ports (80 and 443) and it redirects to other local services that run on other ports. In this approach, there must be some simple criteria that allow the proxy / gateway to know which service it will redirect (ex, clientes.example.com
goes to port 1234 and fornecedores.example.com
goes to 4321). With this, there will be a single service visible externally running on the default port, while internally there will be multiple services running on alternate ports.