Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access to a site on localhost from remote

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?

like image 611
Salvatore Dibenedetto Avatar asked Jul 06 '12 14:07

Salvatore Dibenedetto


2 Answers

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

like image 100
simon Avatar answered Sep 30 '22 12:09

simon


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.

like image 36
kristianp Avatar answered Sep 30 '22 14:09

kristianp