What operating system do you have on your server? On Linux, one of the most common situations that would cause this would be enabled a firewall with ufw. You can see your firewall status with:

ufw status

And if you want to disable it you can do so with ufw disable. Note that that might expose your host more than you want. If, for instance, you want to only allow inbound and outbound on ports 80 and 443, you may want to read the documentation for ufw and install a more subtle policy.