How to expose my localhost to the WWW? (port forwarding?) [closed]

大兔子大兔子 提交于 2019-12-18 05:47:30

问题


I am running Apache/php on my localhost and would like to be able to make this publicly accessible from the internet.

I think this is achieved by port forwarding? Can someone point me in the right direction?


回答1:


It depends on the connection you have.

If your machine has a public IP address, it's on the Internet already. Then all you need is to allow connections to port 80, both on the local firewall and the home/corporate firewall.

If your machine is behind a set-top-box, or inside a corporate network, chances are that you're not on the Internet. In some instances, a router does NAT (Network Address Translation) between a local (non-routable) network and the Internet. In this particular case, you need to set up port forwarding on the set-top-box or router.




回答2:


Well sir you should try ngrok it is free and works with everything that I throw at him (node servers, xampp etc.)




回答3:


You might want to check out Pagekite - it's an open-source software that allows you to expose your local resources to the outer internet without you needing to reconfigure your router or firewall.

There's a similar service called Show off which does much the same thing, although it seems a bit more limited.




回答4:


You could try beame-insta-ssl, it's a good way to get free tunneling services and a free SSL certificate to expose your localhost. It's open source on git here: https://github.com/beameio/beame-insta-ssl/




回答5:


Only port forwarding would work but you would need to connect to your server thru it's IP.

take a look at dyndns.com, there you can get a DNS ID that points to your server.

After that you set your router port 80 (HTTP) or 443(HTTPS) to point to your PC HTTP server port ( this can be any port you wish)




回答6:


It depends of what do you mean localhost? Each system has its own "localhost".

If you mean that you have something like: "your system"<-->"gateway/wifi router"<-->Internet than you should configure port mapping from your router external interface to your server' IP address. Check your gateway/router documentation for more information.




回答7:


Another tool for port forwarding through OpenVPN or SSH tunnel is https://portmap.io . If you're running multiple vhosts on local Apache, you can set host-header with required hostname.



来源:https://stackoverflow.com/questions/4717426/how-to-expose-my-localhost-to-the-www-port-forwarding

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!