Access to a site on localhost from remote

2019-02-26 10:24发布

I use to develop my project on my localhost, on apache in ubuntu machine. Sometimes i need to show progress to my costumer. Is it possible to access to localhost from remote machine?

标签: networking
4条回答
该账号已被封号
2楼-- · 2019-02-26 10:41

There are many methods to do this - the difference is security, easiness of the configuration and cost of the solution.

Following I am typing some methods with some analyses

  1. Port Forwarding (with Dynamic DNS and SSL encryption)

This requires router configuration (to forward your routers public port to loclhoat port), however this requires you to have fixed ip address. In case your ip address is not fixed (in most cases) you need to use Dynamic DNS services to be able to use domain name instead ip address (there are lot of available free services). Here we still have security question open. To solve security question i.e. setup ssl certificate we can use Let’s Encrypt service ( https://letsencrypt.org/ ) to get free certificate, however we should configure local server to use the certificate or we should setup reverse proxy (in most cases nginx or apache) and configure proxy to use certificate.

Conclusion – Hard to setup if we want to have secure connection (can be done for free)

  1. VPN

For this scenario we should use VPN services. We should connect our local machine to VPN then in other side we should connect our client's machine to VPN that will allow us to access to localhost by local IP address. We can set up our own VPN server however this requires knowledge to do it right.

Conclusion – Easy, Paid, Secure, Bad User Experience (connecting to VPN every time you need to connect to localhost)

  1. Tunneling

For this scenario we can use free tunneling services (i.e. https://tunnelin.com/). The process is very straight forward i.e. Register a User, Connect your device to service (by running one line command on device), use Web interface to open/close secure tunnels to the device.

Conclusion – Free, Secure, Easy

查看更多
萌系小妹纸
3楼-- · 2019-02-26 10:44

Yes, if you have a public and static IP. Usually, ISPs offer static ips during a session (i.e. until you disconnect and connect again)

查看更多
聊天终结者
4楼-- · 2019-02-26 10:58

You can use a service that provides a tunnel to your local service, such as localtunnel, pagekite or ngrok. These services simplify setting up remote demos, mobile testing and some provide request inspection as well.

I find ngrok useful because it provides a https address, which is needed to test things like webcam access.

查看更多
Fickle 薄情
5楼-- · 2019-02-26 11:05

Terms used in this answer:

  • Host = machine with site on it
  • Client = machine you are trying to access the host from

If the host and client are on the same network, you can access the host from the client by entering

http://(hostname or ip address)

in your client's browser. If the site is not running on port 80 (for http) or port 443 (for https), add the post as so (this example is for if your server is on 8080, a common alternate port):

http://(hostname or ip address):8080

If the host and client are not on the same network, and you need to reach across the internet from the client to see the host, you will need to make your host available on the internet for the client to access.

This can be extremely dangerous for your information security if you're not sure what you're doing and I'd recommend getting a cheap-o hosting account (can get them for like $10/month at places like 1:1 hosting).

查看更多
登录 后发表回答