PMH
PMH

Reputation: 73

Why need to explicitly specify port 80 to access my website using HTTPS?

I followed the instruction to make my nodejs server listening to port 80.

https://www.digitalocean.com/community/tutorials/how-to-use-pm2-to-setup-a-node-js-production-environment-on-an-ubuntu-vps

My server does not have a domain yet. The problem is that if my server used HTTPS, I cannot access my server without specifying port 80 like this https://xx.xxx.xxx.xx:80. However, using HTTP, without specifying port, I still can access my website using IP.

What did I do wrong here?

Upvotes: 2

Views: 2568

Answers (2)

Fei.W
Fei.W

Reputation: 1

you can find the default port of a certain service in file /etc/services, If the server do not use these default ports, then you have to specify the port as you said to browse.

Upvotes: 0

jmoerdyk
jmoerdyk

Reputation: 5516

Because the default port for https connections is 443. So browsers will connect on that default port if your url has a https protocol and no port number specified.

Since you are using port 80 (which is the default port for plain http), you need to specify the port number in your URL.

In short, you need to specify the port number in your URL if your server is listening on a port other that the default port for that protocol.

Upvotes: 4

Related Questions