How to Make Localhost Accessible by Users of Different Networks Without Hosting
What is Localhost?
localhost who doesn't know that word, especially if you are a programmer, maybe for some people the word "localhost" still sounds foreign, quoted from wikipedia "localhost is a hostname that refers to the current device used to access it".
Thus Localhost is the term used to refer to your own computer when you use it as a virtual server. Keep in mind that localhost can only be accessed by people who are still connected to the same network as one connection with wifi.
Many applications that can run localserver especially windows users such as:
XAMPP is a computer software package whose naming system is taken from the acronym Apache, MySQL (formerly) / MariaDB (now), PHP, and Perl.
Laragon is a software for webserver stack management which includes Apache, PHP, and MySQL and runs on Windows OS.
This software has the same features as other software stacks such as XAMPP and WAMP, but Laragon has various additional features that are suitable for application development for medium to higher levels.
Then how users of different networks can access our localserver?
To do so we need a third party application that is ngrok.
Ngrok is a proxy server to create / open a private network through NAT or firewall to connect localhost to the internet with a secure tunnel
First of all, visit the web ngrok.com
After that, you can register first to use the application, after successfully registering you will be redirected to the dashboard website
To use the application, you can download it on the "Download for Windows" button.
If it has been downloaded, you can directly extract it using WinRAR or a similar application, the result will be an .exe format file, you can move the application to C:\Users\"Username"
"Username" <- the name is different every computer you can customize
now you can open command prompt and type
ngrok.exe config add-authtoken your_token
to get the token you can go back to the ngrok dashboard
it will look like this if you do it right, to activate it you only need to first turn on your localserver then type in the command prompt
ngrok.exe http 80
the command will online your localserver
then ngrok will create a forwarding link to your local server.
https://3154-180-244-160-22.ap.ngrok.io
the link above is forwarding from my localserver, in this case all the links will be different
keep in mind if you disable the command prompt then link forwarding will be useless.
Maybe it's a tutorial from me, thank for reading.