I was wondering if I have index.html and in windows CMD run python -m http.server 80
while in the directory with index.html will it start a server on my IP(given I have port 80 open) and then people can just connect to my IP and see what is in index.html?
Asked
Active
Viewed 770 times
2 Answers
1
If
- your router is portforwarded for TCP 80
- the server is listening on 0.0.0.0
- No firewalls are in the way
Then it will be publically accessible. To make it only available on local host you should host on 127.0.0.1
httpd = ServerClass(("127.0.0.1", 80), HandlerClass)
Edit: the other answer posted this good link, didn't see until after posting: Is it possible to run python SimpleHTTPServer on localhost only?

Community
- 1
- 1

rubenwardy
- 679
- 5
- 21
-
So then it returning `Serving HTTP on 0.0.0.0 port 80 ...` is not an error? – Alexwall Mar 25 '16 at 18:01
-
No, 0.0.0.0 means "all IPv4 addresses on the local machine". – rubenwardy Mar 25 '16 at 18:04
-
127.0.01 is the loop back address. See here for more info: http://www.howtogeek.com/225487/what-is-the-difference-between-127.0.0.1-and-0.0.0.0/ – rubenwardy Mar 25 '16 at 18:04
-
You can use this website to check if your site is accessible: http://www.downforeveryoneorjustme.com Paste your public IP in there, found by google "what is my ip" – rubenwardy Mar 25 '16 at 18:20
-
Thanks, looks like ill be calling my ISP to see if they are blocking portforwarding – Alexwall Mar 25 '16 at 18:21
-
please note that you can't access your own computer by its public IP from within your own network (due to NAT punchthrough, I believe, not sure) – rubenwardy Mar 25 '16 at 18:23
0
People should be able to connect to your public IP without problem. It would be a little more complex if you want to give access only from localhost:
Is it possible to run python SimpleHTTPServer on localhost only?