Pergunta

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?

Foi útil?

Solução

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.

Outras dicas

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

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.

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/

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)

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.

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top