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 | grep HTTP
phrogz@planar:~$ curl -I
curl: (7) couldn't connect to host

phrogz@planar:~$ ifconfig eth0 | grep "inet addr"
          inet addr:  Bcast:  Mask:

phrogz@planar:~$ ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=0.020 ms
64 bytes from icmp_seq=2 ttl=64 time=0.013 ms
--- 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 on and not (or whatever you want). While you don't actually want a thin listening on INADDR_ANY (proxy it through a real webserver, please), you can achieve this by using -a on the thin command line (or -o if you're doing the right thing and using rackup).

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.

  • Bingo! You win money on your first bet. And you're right: normally I don't want this (and don't have this; I'm normally proxied behind Nginx) but I happen to need it temporarily for a bit of LAN testing. Changing address: to address: in my server.yml fixed it. Well done!
    – Phrogz
    Aug 4 '11 at 3:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.