I have a web server (Thin) running on a non-standard port on my Ubuntu 10.04 Server box. I can access the web server via the loopback interface, but not the public IP. Why, and how do I fix the configuration so that other machines on the LAN can access it?
phrogz@planar:~$ curl -s -I http://localhost:9011/login | grep HTTP
HTTP/1.1 200 OK
phrogz@planar:~$ curl -s -I http://192.168.0.84:9011/login | grep HTTP
phrogz@planar:~$ curl -I http://192.168.0.84:9011/login
curl: (7) couldn't connect to host
phrogz@planar:~$ ifconfig eth0 | grep "inet addr"
inet addr:192.168.0.84 Bcast:192.168.0.255 Mask:255.255.255.0
phrogz@planar:~$ ping 192.168.0.84
PING 192.168.0.84 (192.168.0.84) 56(84) bytes of data.
64 bytes from 192.168.0.84: icmp_seq=1 ttl=64 time=0.020 ms
64 bytes from 192.168.0.84: icmp_seq=2 ttl=64 time=0.013 ms
^C
--- 192.168.0.84 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 999ms
rtt min/avg/max/mdev = 0.013/0.016/0.020/0.005 ms
phrogz@planar:~$ uname -a
Linux planar 2.6.32-33-server #71-Ubuntu SMP Wed Jul 20 17:42:25 UTC 2011 x86_64 GNU/Linux
I'll bet that
netstat -ltn
will show that your thin is listening on127.0.0.1
and not0.0.0.0
(or whatever you want). While you don't actually want a thin listening onINADDR_ANY
(proxy it through a real webserver, please), you can achieve this by using-a 0.0.0.0
on the thin command line (or-o 0.0.0.0
if you're doing the right thing and usingrackup
).If that isn't the case, I'll take 10 bob each way on your
iptables
rules getting in the way; exact instructions for fixing that are beyond what can be provided given the available information, but presumably you know enough about your own systems to adjust firewall rules.