chentingpc
chentingpc

Reputation: 1283

Cannot connect to python SimpleHTTPServer but can connect to apache

I was setting up a public Ipython Notebook in my remote Ubuntu 12.04 server according to http://ipython.org/ipython-doc/1/interactive/public_server.html#notebook-public-server, but when all was done, I cannot connect to it via both chrome and safari (in both https and http modes), I got timeout error in chrome, safari told me server isn't responding. So I tested the system by setting up following simple python server:

python -m SimpleHTTPServer

And the same error occured. I also checked the port with sudo netstat -anltp|grep :8000, which seems fine:

tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 22683/python

What surprises me is that I have the apache running and holding websites just fine (I also try to turn it off when configuring python server but that didn't help). Can anyone give me a clue what might be wrong in the Ubuntu server and how I should debug it?


I have found the issue: it turns out that the ports are closed by firewall, although in netstat it says python is listening to port 8000, but when incoming request reaches port 8000 it is rejected before getting to python server. By opening the ports the issue can be well resolved.

Upvotes: 0

Views: 1016

Answers (1)

chentingpc
chentingpc

Reputation: 1283

It turns out that the ports are closed by firewall, although in netstat it says python is listening to port 8000, but when incoming request reaches port 8000 it is rejected before getting to python server. By opening the ports the issue can be well resolved.

Upvotes: 0

Related Questions