Search code examples
localhostngrok

Use localhost:4040 on Windows


I want to know how can I access my localhost folder and go to some file like https://localhost:4040/index.html without using any external software. I just want to know the folder where I have to copy index.html so I can access this link.

I am using ngrok but it returns a 404 error. I tried putting the index.html in the same directory as ngrok.exe


Solution

  • ngrok allows you to expose a web server running on your local machine to the internet.

    1. localhost

    If you just want to access your localhost folder, you don't need ngrok.

    Either way, the first step is to run a web server — a one-liner on Python.

    If you have Python 3:

    python -m http.server 8000
    

    If you have Python 2:

    python -m SimpleHTTPServer
    

    The file is now accessible at http://localhost:8000/index.html.

    2. ngrok

    If you want to access your localhost on another device, run ngrok:

    ngrok http 8000
    

    You should see a line like:

    Forwarding    https://92832de0.ngrok.io -> localhost:8000
    

    The file is now accessible at https://92832de0.ngrok.io/index.html.