Make my webserver accessible to the outside world?
Hi, I'm new to Linode. I'm trying to set up an nginx webserver on my first Linode. Here are the particulars:
I have nginx installed and configured to listen on port 8080.
I'm going to point a node balancer at it later, hence the nonstandard port.
The website is http://jakerobb.dev:8080
The DNS name resolves for me correctly to my Linode's public IP: 23.92.20.152. This works both on the Linode itself and from my local terminal.
I can SSH from my local machine to my Linode via the IP and via the hostname.
nginx is running
I can
curl jakerobb.dev:8080
from the Linode and get back nginx's default index.html (it also works if I uselocalhost
or the public IP rather than the domain name)When I try to reach the site using either the public IP or the domain name from my local browser or from local
curl
, I get "Connection Refused"I reviewed my Linode's
iptables --list
and didn't see anything troubling, but I'm not an iptables expert and could easily have missed something.netstat -tlpn
reports that nginx is listening on port 8080 on all IPv4 and IPv6 interfaces:[root@www1 ~]# netstat -tlpn | grep nginx tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 3209/nginx: master tcp6 0 0 :::8080 :::* LISTEN 3209/nginx: master
My initial assumption was that Linode must have some port-blocking firewall system, with a very restrictive default, perhaps only allowing port 22 -- but I can't find any such thing in the Manager console.
What do I need to do to make this work? Thanks!
5 Replies
I tried spinning up an additional Linode and seeing if I could access the webserver from there. I can ping the public IP (and the domain name), but when I try curl
, I get No route to host
.
Next, I added private IPs to both servers, and tried curl
ing from one to the other via its private IP. Same error.
So, whatever is blocking my TCP traffic to port 8080 is not posing the same restriction on ICMP (ping) traffic.
The only open or available port on your server is 22 SSH. I would look at your firewall rules because that’s most likely what’s blocking connections.
The only open or available port on your server is 22 SSH. I would look at your firewall rules because that’s most likely what’s blocking connections.
Thanks, but note in my original post that I wrote:
My initial assumption was that Linode must have some port-blocking firewall system, with a very restrictive default, perhaps only allowing port 22 -- but I can't find any such thing in the Manager console.
What firewall rules? Where? I have no idea how to do that.
Okay, I found it. Google led me here:
https://www.linode.com/docs/security/firewalls/introduction-to-firewalld-on-centos/
I was unfamiliar with on-machine firewalls -- I've always used environments in the past where that was managed by a hardware appliance, and it didn't occur to me that it would be configured inside the VM.