I am trying to run a webserver from Ubuntu Bash on Windows 10 using the following:

python -c 'import BaseHTTPServer as bhs, SimpleHTTPServer as shs; bhs.HTTPServer(("", 8888), shs.SimpleHTTPRequestHandler).serve_forever()'

However, I cannot connect to it from other machines. Only on Localhost. It does work if I run it from windows python.

I tried adding a bash rule for bash.exe in the Windows firewall, but nothing works. Any ideas?

  • Ubuntu Bash onWin10 needs to be documented more properly... BTW, what happens when you run the server on a Linux box on the same network?
    – sbrm1
    Sep 1 '16 at 19:10
  • @sbrm1 You mean an actual Linux installation? Everything works! Even on Windows the same code works. It's definitely something to do with the unix subsystem not accepting connections from outside.
    – unixsnob
    Sep 2 '16 at 11:29
  • Well, the Windows Subsystem for Linux is still in beta...
    – sbrm1
    Sep 3 '16 at 2:10

I had a problem using python -m SimpleHTTPServer today. It turned out to be windows firewall / networking related. I could easily access the content via, just not

  • check the firewall
  • check the network
  • try to use a sensible IP address & non-conflicting port

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.