方式一:使用ngrok免费https域名,访问本地,服务器的项目

1.注册登录

ngrok官网地址

2.下载安装自己系统对应的版本

在这里插入图片描述

3.配置自己的token

文件安装解压后,配置自己的token:

ngrok config add-authtoken 28nHyzzzzzzsUgfZ8fPkU9CLYq_6RuJroE000000(自己的token)

4.启动ngrok服务

ngrok http <你需要开发的端口号>

在这里插入图片描述

5.访问测试

访问ngrok提供的域名:红框域名即可
在这里插入图片描述

方式二:使用ngrok镜像

操作如下:

Run an ngrok agent pointed at localhost:80

docker run --net=host -it ngrok/ngrok http 80

Access the web inspector on the host machine at localhost:3000

docker run -it --p 3000:4040 ngrok/ngrok http 80

Run the ngrok agent with auth token ‘xyz’

docker run -it -e NGROK_AUTHTOKEN=xyz ngrok/ngrok:alpine http 80

Run the ngrok agent with the config file ‘./ngrok.yml’ from the host machine

docker run -it -v $(pwd)/ngrok.yml:/etc/ngrok.yml -e NGROK_CONFIG=/etc/ngrok.yml ngrok/ngrok:alpine http 80
Logo

欢迎加入DeepSeek 技术社区。在这里,你可以找到志同道合的朋友,共同探索AI技术的奥秘。

更多推荐