Domanda

I am trying to make my laptop a http server. For starters, I am running:

"python -m SimpleHTTPServer 8080"

I think I should be able to access this server at http://my.pub.lic.ip:8080 (I obtained my.pub.lic.ip from www.whatismyipaddress.com). However, this does not work. I do not know what the problem is. Could it be that:

  1. Network service provider does not allow hosting?
  2. Disabling firewall? (I did try "sudo ufw disable" (I run ubuntu) but it did not fix the issue).
  3. Port 8080 in the URL does not map to 8080 on my machine? (should I do some port forwarding or something? If so, how should I do it?)
È stato utile?

Soluzione 3

I appreciate all inputs. I recently found out what you all meant by "open" the port. The answer lies in iptables (specifics of which: https://superuser.com/questions/634469/need-iptables-rule-to-accept-all-incoming-traffic )

Also for external clients to access the server, one has to change the /etc/hosts file to establish the server name -> IP mapping.

This article was really helpful to me as someone who does not know basics of networking (http://computernetworkingnotes.com/network-administration/how-to-configure-apache-server-in-linux.html) . It gives a step by step process of setting up an apache server.

Thanks again!

Altri suggerimenti

1st is you must set a static local ip for your computer that is running the server.

If you want to access it from a local network, all you really need to do is open the port 8080 in your firewall, then go on another computer on the network and type the local ip of the server and there you go..

example for local network: 192.168.1.150:8080

But if you want to run it for the public, you have to go into your router and enable port forwarding to port 8080 and open port 8080 in your firewall.

example for public access where x.x.x.x is the public ip: x.x.x.x:8080

If there is anything else please let me know. :)

connect to 127.0.0.1 instead of your public ip.

127.0.0.1 is called localhost, and always points to your own machine.

That way it doesn't matter if any NAT routing firewalls or anonymous proxy servers are hiding your local network IP from whatismyipaddress.com

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top