Is it possible to host, instead of a web app, a HTML file with NGROK? I really don't know anything about NGROK, I just used it to host a server for a Twilio app, and am wanting to use it to host a HTML file for another one of my projects. Also, anybody know how to create a HTML file on a Mac? Thanks in advance. Or, If I can't use NGROK, anybody know something as easy and free is it is that I could use for hosting a HTML file on my computer. I need to be able to change the file in real time, so google sites and stuff like that are out of the question.
4 Answers
No. ngrok only tunnels traffic, so it can't actually serve the HTML file for you.
You can, however, serve a directory of files very easily. One of the quickest ways to start a server is with python. From the command line, cd
to the directory containing your HTML files and run:
$ python -m SimpleHTTPServer
Or for python3 (not installed by default on OS X):
$ python -m http.server
Then, in another terminal, run ngrok
.

- 10,687
- 3
- 47
- 54
-
In your first example, is "SimpleHTTPServer" the name of the directory or part of the command? – user3473819 May 02 '14 at 23:02
-
It is part of the command. It runs the python [SimpleHTTPServer](https://docs.python.org/2/library/simplehttpserver.html). – ford May 02 '14 at 23:15
-
Can I do the same with, instead of a directory, a single file? – user3473819 May 03 '14 at 18:05
-
Sure, just put only the single file in the directory and name it `index.html`. – ford May 03 '14 at 19:00
-
Could I do the same with, instead of a HTML file, an audio or other media file? – user3473819 May 03 '14 at 22:18
-
Absolutely. Don't be afraid to just try stuff out! – ford May 05 '14 at 14:08
-
I mean, could I have the webpage open to an audio file instead of a "Directory Listing for /" page with the audio as a subpage? – user3473819 May 10 '14 at 01:55
-
2It sounds like you should ask a new question about this specifically. – ford May 10 '14 at 14:57
Yes. ngrok now has a built-in fileserver. https://ngrok.com/docs/secure-tunnels/tunnels/http-tunnels#file-url
Their example command Linux/mac:
ngrok http -auth="user:password" file:///Users/alan/share
Windows:
ngrok http -auth="user:password" "file:///C:\Users\alan\share"
This will create an HTTP server with a basic auth username and password, sharing all files in the directory /Users/alan/share
.

- 694
- 10
- 20
-
1what is the correct way to point the directory in Windows? I tried file://C:/app/asd but nothing happend – Roy Ryando Apr 20 '20 at 14:41
-
-
1updated docs link: https://ngrok.com/docs/secure-tunnels#http-tunnels-file-urls – nth-child May 23 '22 at 23:54
-
1Updated docs link: https://ngrok.com/docs/secure-tunnels/tunnels/http-tunnels#file-url – Adam Lindberg Nov 17 '22 at 11:50
thanks to Zach that explained above the file directory of ngrok
When you want to server HTML files on ngrok after you run command
ngrok http <port_number>
You go to <your_ngrok_address>:
http://your_ngrok_adress.ngrok.io
You go to the page that in the top section of it, if you haven't configured your ngrok auth_token there is this message to sign-up into free account to server HTML files, click the link for sign-up.
After you signed up, you'll be redirected to your dashboard which explained below command to run:
ngrok authtoken <your_auth_token>
After you run the above command then run the first command again:
ngrok http "file:///<your_html file location/direcoty>"
there you'll se your files directory, navigate through them to reach your HTML file/directory (if neccessary) there it'll serve them for you.

- 69
- 2
- 4
To forward to a local file:/// URL, first create an account at ngrok: https://dashboard.ngrok.com/signup
Your auth token will be available on your dashboard at https://dashboard.ngrok.com/get-started/your-authtoken
Add the ngrok auth token to your machine using:
ngrok config add-authtoken <YOUR_NGROK_AUTH_TOKEN>
Then start the ngrok server:
ngrok http <FILE_PATH_OF_FOLDER>
e.g.,
ngrok http file:///Users/some_user/Desktop/
Your local file will get forwarded to the forwarding URL through ngrok
.
Go to your forwarding URL to look at the files.

- 25,981
- 23
- 80
- 125

- 11
- 3