STERFIELD

2014/01/29

Exposing your local web server to the Internet

Exposing your local web server to the Internet

Sometimes, you’re setting up your web server(Apache, Nginx etc) in your local computer. It means your web server is running locally and outside world can’t access to it, other computer in same intranet can access your IP though.

Let’s say, you have developed a web project in your local. You haven’t uploaded projects files and folders to remote hosting server. At that time, your client wanna check the project’s progress at once.

No need to worry in such case. You can immediately setup a localtunnel that can be accessed by outside world with a URL link.

So simple steps you need to do:

Step 1: Download ngrok

https://ngrok.com/download

Step 2: Unzip it

$ unzip /path/to/ngrok.zip

Step 3: Run it! (in terminal)

$ ./ngrok -help [if you wanna check how does it work]

$ ./ngrok 80 [eg; local web server is running in port 80]

Sample command line output:

Local running web server: http://127.0.0.1:80

Share this URL to client: http://3a4bfceb.ngrok.com

Web traffic checking: http://127.0.0.1:4040

web-interface-checking-point

[Ref img: from https://ngrok.com/usage]

Requiring passwords to access your tunnels

By default, ngrok tunnels do not require any username or password to access them. This means anyone who knows or guesses the URL or your tunnel can make requests to it. You can secure your tunnels with a username and password by specifying the -httpauth option when creating your tunnel. This will force HTTP basic authentication on all incoming requests to your tunnels and require that the credentials match those you specify on the command line.

If you developer guy wanna quit running instance after checking the developed project by client, you just need to use simple command in terminal: [ Ctrl+C ]
Outside world can not be available to access your shared link: http://3a4bfceb.ngrok.com anymore.

In next time, you will run ./ngrok 80 in terminal and you will get another shared link: eg; http://xxxxx.ngrok.com. Just send that new link to client or others else you want to send again.

Enjoy!!!

Author Profile

著者近影

スターフィールド編集部

SHARE

合わせて読みたい