Host HTML file with ngrok

一曲冷凌霜 提交于 2020-01-01 04:46:06

问题


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.


回答1:


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.




回答2:


Yes. ngrok now has a built-in fileserver. https://ngrok.com/docs

Their example command:

ngrok http -auth="user:password" file:///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.



来源:https://stackoverflow.com/questions/23438032/host-html-file-with-ngrok

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!