If you are a web developer, then you are using localhost for testing your website. But you probably want to share your website to your clients or your friends to show them. Uploading website files on a public server is a time consuming work for just to show them. So here are the solution.
localhost is accessible on local network, but if you want to access from internet. You have to use a separate software for this. Because this is little bit confusing to create a public ip address for your system. So ngrok will help you.
Access localhost from internet using Ngrok
Ngrok is a very popular and easy to use software. it comes with free and paid version.
It has been used to create a tunnel between your localhost and the web. ngrok provides you a public url that is accessible from internet.
This application is available for windows, linux and mac OS.
Great thing with ngrok is that you can inspect the server request on your dashboard http://localhost:4040 and you can also see the details of requests.
Steps to install Ngrok.
1.Download Ngrok https://ngrok.com/download
2. after downloading the ngrok, go to that directory where you have downloaded in your terminal. then extract it.
3.Run ngrok with your authorization token. if you have not, just sign up to ngrok and it will give you a authtoken to run first time on your computer.
4.Run ngrok for http://localhost:80
You will see a dashboard on your terminal and, there will be two url’s shown. you can use these url’s for accessing localhost from anywhere on the web.
Now you can access local dashboard also on the system browser for showing requests in details. http://localhost:4040
This is your configurations.
It is okay and you become happy. Now you can share your website over the internet without uploading it to the public server. In general what we do is that we didn’t set the database password. If database password is not set, anyone can access your phpmyadmin. So make sure you have set the password for phpmyadmin.
Thats’it. have a nice work!