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.

Disclosure: on the server, I am a nooooob. There I said it.

so I have a vm running ubuntu with a BRIDGED network connection and running a python web-server on port 8000. When I go to http://localhost:8000/ inside the vm, all is working as expected. But I need to access this web-server from outside the vm on the same machine. I used ifconfig to get the local network ip 192.168.1.131 of the ubuntu vm. Now if I visit http://192.168.1.131 in my browser outside the vm I get a page stating:

It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.

However this is not my python web-server, its something else running on port 80. My python is running in port 8000, and when I got to http://192.168.1.131:8000 I get:

Unable to connect

      Firefox can't establish a connection to the server at 192.168.1.131:8000.

What is going on here? Could ubuntu be blocking incoming connection in 8000 but allowing them on 80? This is a fresh install on the vm of Ubuntu 12.04 LTS 64 bit. Any help is appricated. Thanks.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Your Python web server can choose which address(es) it listens to. It might be listening only on the localhost address (127.0.0.1) and not on the external IP address 192.168.1.131. On the other hand, Apache (or whatever is responding on port 80) is probably listening on all addresses, including both localhost and your external IP address.

To do this with Django, try using:

runserver 0.0.0.0:8000

See the documentation for django-admin for further details.

share|improve this answer
    
how would I go about doing that? –  Fresheyeball Aug 15 '12 at 23:40
    
Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C. is what I get when I start the server, so I think you are probably right. –  Fresheyeball Aug 15 '12 at 23:41
    
@Fresheyeball: I've updated my answer with instructions for Django. –  Greg Hewgill Aug 15 '12 at 23:47
    
THAT DID IT! Thank you so much, I'd been struggling with this step in setting up my dev environment for some time. –  Fresheyeball Aug 15 '12 at 23:54
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.