Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

I'll bet that netstat -ltn will show that your thin is listening on 127.0.0.1 and not 0.0.0.0 (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 0.0.0.0 on the thin command line (or -o 0.0.0.0 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.

share|improve this answer
    
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: 127.0.0.1 to address: 0.0.0.0 in my server.yml fixed it. Well done! –  Phrogz Aug 4 '11 at 3:50
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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