Reputation: 61
When I try to run server on gce with a command like npm run start
on port 80,
I see this message
Port 80 is taken; using 40363 instead ...
I tried to find any process that is using port 80, but I can't find anything.
Tried sudo lsof -i : 80
, netstat -lntp
... nothing...
Can't I use port 80 on GCE?
Upvotes: 1
Views: 1980
Reputation:
Thanks for asking this up. There can be several reasons this might be happening.
A small note on Port 80: The Port 80 is used for HTTP communication and Port 443 is for HTTPS communication. For some reason, the VM is not allowing your program to start up in Port 80.
Listing down the areas to check and resolve this issue.
1. Check your basic VM firewall
While creating the VM, you might have forgot to tick the HTTP/HTTPS traffic boxes. To edit it again, stop the VM, click edit and tick the boxes as shown below.
2. Check if there is any firewall override
If you have added custom tags to the VM and applied additional firewall rules in the Firewall section of GCP, it might also lead to this scenario.
3. Other apps on this port (Ruled out)
Since you have mentioned no other apps are running in that port, this might not be applicable.
4. If none works, try creating a External IP
There are cases where an external IP was required to help the VM expose port 80 for HTTP communication for external visitors.
Upvotes: 1