Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Host HTML file with ngrok

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.

like image 398
user3473819 Avatar asked May 02 '14 22:05

user3473819


People also ask

How do I host a file in Ngrok?

Forwarding to a local file:/// URL is only available after you sign up to ngrok. So you need to first Sign up at: https://dashboard.ngrok.com/signup. Your local file will get forwarded to the forwarding URL through ngrok.

How do I host an HTML file?

To host a web page on Google Drive: Create a folder in Google Drive and set the sharing permission to “Public on the Web.” Upload the HTML, JavaScript and CSS files for your web page to the new folder. Select the HTML file, open it and click the “Preview” button in the toolbar.

How do I open an HTML file in Termux?

There are lots of method to open html file. 1)Just simple,run xdg-open bonteq. html in termux,and select favourite browser, 2)open file manager and select html file directly,it should be open by system default html viewer or browser 3) got to chrome browser and type file:///sdcard and browse you html file.


3 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.

like image 59
ford Avatar answered Oct 09 '22 01:10

ford


Yes. ngrok now has a built-in fileserver. https://ngrok.com/docs/secure-tunnels#http-tunnels-file-urls

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.

like image 28
Zach Avatar answered Oct 09 '22 02:10

Zach


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.

like image 1
Ali Alavizadeh Avatar answered Oct 09 '22 02:10

Ali Alavizadeh