Easily Provide a Web Page from Your Own Computer

Okan Özşahin
2 min readMay 6, 2022

--

https://gokhansengun.com/kendi-bilgisayarindan-web-sayfasi-sunmak/

You can safely open the services you run on your computer to the internet with ngrok. ngrok creates a secure tunnel between our computer and the internet, transmits requests from the internet to our computer and transmits the response it receives to the client.

Usually working with APIs, need to get callbackurl’s requests. I am present here so simple way to do that with ngrok. Just with three lines of code.

For MacOS, use HomeBrew to install ngrok:

brew install ngrok/ngrok/ngrok

For Linux, use Apt:

curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | \
sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && \
echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | \
sudo tee /etc/apt/sources.list.d/ngrok.list && \
sudo apt update && sudo apt install ngrok

To Start ngrok firstly run web server on 8000 port:

python3 -m http.server 8000

then start ngrok to accept requests:

ngrok http 8000

We use the ngrok http 8000 command to open our web server, which we run from the 8000 port, to the internet. As can be seen in the terminal output, ngrok opens port 8000 to the internet via http://a44c3a39.ngrok.io and https://a44c3a39.ngrok.io. Of course, these addresses will change every time you run it.

Then go to web interface as open http://127.0.0.1:4040 on your browser. This interface be provide to see requests that done your endpoint. The endpoint given with randomly by ngrok. You can see that endpoint on terminal that started ngrok as web interface.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Okan Özşahin
Okan Özşahin

Written by Okan Özşahin

Backend Developer at hop | Civil Engineer | MS Computer Engineering

No responses yet

Write a response