Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't Connect to my Simple Http Server on http://127.0.0.1:8000/ or external IP

I have python 3.8.1 installed on my Windows 10 PC.

I run the following command from PowerShell in the directory I want to set as server

python -m http.server 8000

I get the following response after running the command

Serving HTTP on :: port 8000 (http://[::]:8000/) ...

I'm able to access the directory on localhost:8000 but not 0.0.0.0:8000 or http://127.0.0.1:8000/

I can't access the server on my external Ip from the same PC or a different PC on the Same network.

I checked the firewall to make sure Python was an accepted app and my network was set to private.

like image 772
Ebrahim Karam Avatar asked Oct 15 '25 04:10

Ebrahim Karam


1 Answers

Even though the documentation didn't state this. I presumed that the server wasn't binding to all the available ports. In PowerShell, I tried running

python -m http.server 8000 --bind 0.0.0.0

I got the following response instead

Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...

I was able to access the Server on the following addresses

  • http://127.0.0.1:8000/
  • http://localhost:8000/
  • externalip:8000 (on both the same PC and a PC connected on the same network)

Hope this helps someone other than me

like image 145
Ebrahim Karam Avatar answered Oct 16 '25 23:10

Ebrahim Karam